Transcript

ICE Introduction

Introduction

Ice is an object-oriented middleware platform. Fundamentally, this means that Ice provides tools, APIs, and library support for building object-oriented client–server applications. Ice applications are suitable for use in heterogeneous environments: client and server can be written in different programming languages, can run on different operating systems and machine architectures, and can communicate using a variety of networking technologies. The source code for these applications is portable regardless of the deployment environment.

Terminology

• Clients and Servers• Ice Objects

– An Ice object is an entity in the local or a remote address space that can respond to client requests.

– If an object has multiple simultaneous instantiations, it is still a single Ice object.

– Each Ice object has one or more interfaces. Clients issue requests by invoking operations.

– Each Ice object has a unique object identity(ID/UUID).

Terminology

• Proxies– 1. Locates the Ice object– 2. Activates the Ice object’s server if it is not

running– 3. Activates the Ice object within the server– 4. Transmits any in-parameters to the Ice

object– 5. Waits for the operation to complete– 6. Returns any out-parameters and the return

value to the client (or throws an exception in case of an error)

Terminology

• Proxy: Direct ,Indirect ,Fixed Proxies• Servants– In practice, a servant is simply an instance of a

class that is written by the server developer and that is registered with the server-side run time as the servant for one or more Ice objects.

• At-Most-Once Semantics– retries are attempted only if it is known that a

previous attempt definitely failed. This semantics guarantee that operations that are not idempotent can be used safely

• Synchronous Method Invocation• Asynchronous Method Invocation• (Batched)Oneway Method Invocation– Thread-Per-Message– TCP/IP or SSL

• (Batched)Datagram Invocations– A datagram invocation uses UDP to invoke the

operation.

Language Mappings

• provided language mappings: C++, Java, C#, Python, Objective-C

• client side:PHP and Ruby.

Client and Server Structure

Ice Protocol

• Ice provides an RPC protocol that can use either TCP/IP or UDP as transport. In addition, Ice also allows you to use SSL as a transport.– message types– protocol state machine– encoding rules that determine how each type of data is

represented on the wire– header for each message type

Hello World

module Demo { interface Printer { void printString(string s); };};

slice2java Printer.ice

Basic Slice Types

User-Defined Types

• Enumerations• Structures• Sequences• Dictionaries• Constant Definitions and Literals

Object Adapters

• AMI– At client

• AMD– At Server(same as AMI)

User AMI and AMD

["ami"] interface I {bool isValid();float computeRate();

};interface J {

["amd"] void startProcess();["ami", "amd"] int endProcess();

};

ICE protocol

• Data Encoding– Size(255 rule)

• Encapsulation• Slice– Format like:[int,data]– data’s length is“slice.length-4”

• Basic Types• Strings:UTF8

ICE protocol

• Sequences:[size,{a,b,c…}]• Dictionaries:[size,{struct, struct, struct…}]• Enumerators– [1 – 127]byte.– [128 - 32767]short– [>32767]int– The value is the ordinal value of the

orresponding enumerator, with the first enumerator value encoded as zero.

• Structures

ICE protocol

Exceptionsexception Base {

int baseInt;string baseString;

};exception Derived extends Base {

bool derivedBool;string derivedString;double derivedDouble;

};

ICE protocol

ICE Protocol

• Data Encoding– Sizes– Encapsulations– Slice:

• To allow the receiver of an exception or class to ignore those parts of a value that it does not understand, exception and class values are marshaled as a sequence of slices

– Types

ICE Protocol

• Protocol Messages Types– Request (from client to server) – Batch request (from client to server) – Reply (from server to client) – Validate connection (from server to client) – Close connection (client to server or server to

client)

ICE Protocol

Request Message Body struct RequestData {

int requestId;Ice::Identity id;Ice::StringSeq facet;string operation;byte mode;Ice::Context context;Encapsulation params;

};

ICE Protocol

• Batch Request Message Body struct BatchRequestData {

Ice::Identity id;Ice::StringSeq facet;string operation;byte mode;Ice::Context context;Encapsulation params;

};

ICE Protocol

• Reply Message Body struct ReplyData {

int requestId;byte replyStatus;Encapsulation body; // messageSize - 19 bytes

};

ICE Protocol

• Validate Connection Message A server sends a validate connection message when it receives a new connection The message indicates that the server is ready to receive requests; the client must not send any messages on the connection until it has received the validate connection message from the server.

• Close Connection Message

ICE Protocol

• Compression – Compression may not be supported on all

platforms or in all language mappings.– Compression can be used in a request or batch

request only if the endpoint advertises the ability to accept compressed messages

– For efficiency reasons, the Ice protocol engine does not compress messages smaller than 100 bytes.

IceGrid

IceGrid

IceGrid

• load balancing types – Random – Adaptive – Round Robin – Ordered

IceGrid-Registry Replication

IceGrid-Registry Replication

1. The slave replica contacts the master replica at startup and synchronizes its databases. Any subsequent modifications to the deployed applications are made via the master replica, which distributes them to all active slaves.

2. The nodes contact the master replica at startup to notify it about their avail-ability.

3. The master replica provides a list of slave replicas to the nodes so that the nodes can also notify the slaves.

4. The client’s configuration determines which replica it contacts initially.

5. In the case of a failure, the client automatically fails over to the slave. If the master registry’s host has failed, then Node1 and any servers that were active on this host also become unavailable. The use of object adapter replication (see Section 38.9) allows the client to transparently reestablish communication with a server on Node2.

Facets and Versioning

THANKS

top related