Top Banner
ICE Introduction
34
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ice

ICE Introduction

Page 2: Ice

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.

Page 3: Ice

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).

Page 4: Ice

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)

Page 5: Ice

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

Page 6: Ice

• 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.

Page 7: Ice

Language Mappings

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

• client side:PHP and Ruby.

Page 8: Ice

Client and Server Structure

Page 9: Ice

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

Page 10: Ice

Hello World

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

slice2java Printer.ice

Page 11: Ice

Basic Slice Types

Page 12: Ice
Page 13: Ice

User-Defined Types

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

Page 14: Ice

Object Adapters

Page 15: Ice

• AMI– At client

• AMD– At Server(same as AMI)

Page 16: Ice

User AMI and AMD

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

};interface J {

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

};

Page 17: Ice

ICE protocol

• Data Encoding– Size(255 rule)

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

• Basic Types• Strings:UTF8

Page 18: Ice

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

Page 19: Ice

ICE protocol

Exceptionsexception Base {

int baseInt;string baseString;

};exception Derived extends Base {

bool derivedBool;string derivedString;double derivedDouble;

};

Page 20: Ice

ICE protocol

Page 21: Ice

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

Page 22: Ice

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)

Page 23: Ice

ICE Protocol

Request Message Body struct RequestData {

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

};

Page 24: Ice

ICE Protocol

• Batch Request Message Body struct BatchRequestData {

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

};

Page 25: Ice

ICE Protocol

• Reply Message Body struct ReplyData {

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

};

Page 26: Ice

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

Page 27: Ice

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.

Page 28: Ice

IceGrid

Page 29: Ice

IceGrid

Page 30: Ice

IceGrid

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

Page 31: Ice

IceGrid-Registry Replication

Page 32: Ice

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.

Page 33: Ice

Facets and Versioning

Page 34: Ice

THANKS