18
Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 1 Jini Kurzfassung als Kapitel für die Vorlesungen „Verteilte Systeme“ bzw. „Ubiquitous Computing“ Friedemann Mattern (unter Nutzung von Teilen von Andreas Zeidler und Roger Kehr) Infrastructure (“middleware”) for dynamic, cooperative, spontaneously networked systems facilitates realization of distributed applications Jini Jini

Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

  • Upload
    others

  • View
    27

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 1

JiniKurzfassung als Kapitel für die Vorlesungen „Verteilte Systeme“ bzw. „Ubiquitous Computing“

Friedemann Mattern(unter Nutzung von Teilen von Andreas Zeidler und Roger Kehr)

F. Ma. 2

Infrastructure (“middleware”) for dynamic, cooperative, spontaneously networked systems

facilitates realization of distributed applications

JiniJini

Page 2: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 2

F. Ma. 3

Infrastructure (“middleware”) for dynamic, cooperative, spontaneously networked systems

facilitates realization of distributed applications

Jini

• framework of APIs with usefulfunctions / services

• helper services (discovery, lookup,...)• suite of standard protocols andconventions

F. Ma. 4

Infrastructure (“middleware”) for dynamic, cooperative, spontaneously networked systems

facilitates realization of distributed applications

Jini

• services, devices, … find each other automatically (“plug and play”)

• added, removed components• changing communication relationships• mobility

Page 3: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 3

F. Ma. 5

Jini

Infrastructure (“middleware”) for dynamic, cooperative, spontaneously networked systems

facilitates realization of distributed applications

Based on Java and implemented in Javamay use RMI (Remote Method Invocation)typed (object-oriented) communication structurerequires JVM / bytecode everywherecode shipping

F. Ma. 6

Jini

Strictly service-orientedeverything is a service (hardware / software / user)Jini system is a federation of servicesmobile proxy objects for service access

Infrastructure (“middleware”) for dynamic, cooperative, spontaneously networked systems

facilitates realization of distributed applications

Based on Java and implemented in Javamay use RMI (Remote Method Invocation)typed (object-oriented) communication structurerequires JVM / bytecode everywherecode shipping

Page 4: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 4

F. Ma. 7

Everything is a servicee.g. persistent storage, software filter, help desk, …

Jini’s run-time infrastructure offers mechanisms for adding, removing, finding, and using servicesServices are defined by interfaces and provide their functionality via their interfaces

services are characterized by their type and their attributes (e.g. “600 dpi”, “version 21.1”)

Services (and service users) “spontaneously”form a system (“federation”)

Service Paradigm

F. Ma. 8

Jini: Global Architecture

Lookup Service (LUS)main registry entity and brokerage service for services and clientscontains informationen about available services

Servicesspecified by Java interfacesregister together with proxy objects and attributes at the LUS

Clientsknow the Java interfaces of the services, but not their implementationfind services via the LUSuse services via proxy objects

LookupService

ClientClientClient ServiceServiceService

Page 5: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 5

F. Ma. 10

Network Centric

Jini is centered around the networkremember: “the network is the computer”

Network = hardware and software infrastructureincludes helper services

View is “network to which devices are connected to”, not “devices that get networked”

network always exists, devices and services are transientSet of networked devices is dynamic

components and communication relations come and goJini supports dynamic networks and adaptive systems

added and removed components should affect other components only minimally

F. Ma. 11

Spontaneous Networking

Objects in an open, distributed, dynamic world find each other and form a transitory community

cooperation, service usage, …

Typical scenario: client wakes up (device is switched on, plugged in, …) and asks for services in its vicinityFinding each other and establishing a connection should be fast, easy, and automatic

Page 6: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 6

F. Ma. 14

Some Fallacies of CommonDistributed Computing Systems

The idealistic view…the network is reliablelatency is zerobandwidth is infinitethe network is securethe topology is stablethere is a single administrator

…isn’t true in realityJini addresses some of these issues at least it does not hide or ignore them

F. Ma. 15

Bird’s-Eye View on Jini

Jini consists of a number of APIsIs an extension to the Javaplatform dealing with distributed computingIs an abstraction layer betweenthe application and theunderlying infrastructure (network, OS)

Jini is a kind of “middleware”

Network

Operating system

Java technology

JiniJini technologytechnology

Applications Services

Page 7: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 7

F. Ma. 16

Jini’s Use of Java

Jini requires JVM (as bytecode interpreter)homogeneity in a heterogeneous worldis this realistic?

But: devices that are not “Jini-enabled” or that do not have a JVM can be managed by a software proxy which resides somewhere in the net

run protocolsfor discovery and join; have a JVM

F. Ma. 17

Jini Infrastructure

Main components are:lookup service as repository / naming service / traderprotocols based on TCP/UDP/IP

discovery & join, lookup of servicesproxy objects

transferred from service to clientsrepresent the service locally at the client

Goal: spontaneous networking and formation of federations without prior knowledge of local network environmentProblem: How do service providers and clients learn about their local environments?

Page 8: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 8

F. Ma. 18

Lookup Service (LUS)

Main component of every Jini federationRepository of servicesSimilar to naming services of other middlewarearchitectures or RMI registryTasks:

“help-desk” for services and clientsregistration of services (services advertise themselves)distribution of services (clients lookup and find services)

has mechanisms to bring together services and clients

F. Ma. 19

Lookup Service

Client

Lookupservice

Service

-

registerlook

up

use

Jini-Federation

Page 9: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 9

F. Ma. 20

Example

Lookup service

Officeapplication

Printerproxy arbitrary protocol

Communication betweenapplication and printer via functional calls of the proxy

Printerproxy

Printerproxy

F. Ma. 21

Lookup Service

Uses Java RMI for communicationobjects („proxies“) can migrate through the net

Not only name/address of a service are stored (as in traditional naming services), but also

set of attributese.g.: printer(color: true, dpi: 600, ...)

proxies, which may be complex classese.g. user interfaces

Further possibilities:increase robustness by running redundant lookup servicesresponsibility can be distributed to a number of (logically separated) lookup services

Page 10: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 10

F. Ma. 22

Discovery: Finding a LUS

Goal: Find a lookup service (without knowing anything about the network) to

advertise (register) a servicefind (look up) an existing service

Discovery protocol:multicast to well-known address/portlookup service replies with a serialized object (its proxy)

communication with LUS via this proxy

F. Ma. 23

DiscoveryWhere is the lookupservice?

Lookup Service

???

Lookup ServiceThat’s me!!!

Multicast Request

Reply

Communication

Lookup ServiceLookup ServiceLookup Service

ProxyProxy

Lookup-Service

ProxyProxy

Page 11: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 11

F. Ma. 24

Multicast Discovery Protocol

No information about the host network neededActive search for lookup servicesDiscovery request uses multicast UDP packets

multicast address for discovery is 224.0.1.85default port number of lookup services is 4160recommended time-to-live is 15usually does not cross subnet boundaries

Discovery reply is establishment of a TCP connectionport for reply is included in multicast request packet

F. Ma. 25

Join: Registering a Service

Service provider already has a proxy of the lookup serviceIt uses this proxy to register its serviceGives the lookup service

its service proxyattributes that further describe the service

Service provider can now be found and used in this Jini federation

Page 12: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 12

F. Ma. 26

...

Lookup Service

Service database in LUS

Join

Lookup ServiceLookup Service

ProxyProxy

Entry 1 Entry 2 Entry n...Serviceproxy

Entry1Entry2 Entry n...Serviceproxy

Registration

Service

Registration

F. Ma. 27

Join: More Features

To join, a service supplies:its proxyits ServiceID (if previously assigned; “universally unique identifier”)set of attributes(possibly empty) set of specific lookup services to join

Service waits a random amount of time after start-upprevents packet storm after restarting a network segment

Registration with a lookup service is bound to a leaseservice has to renew its lease periodically

Page 13: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 13

F. Ma. 28

Lookup: Searching Services

Client creates query for lookup servicein form of a “service template”matching by registration number of service and/or service typeand/or attributes possibleattributes: only exact matching possible (no “larger-than”, ...)wildcards possible („null“)

Via its proxy at the client, the lookup service returns zero, one or more matches (i.e., server proxies)Selection usually done by client

Client uses service by calling functions of service proxyAny protocol between service proxy and service provider possible

F. Ma. 29

...

Lookup Service

Service database in LUS

Entry1Entry2 Entry n...ServiceServiceproxyproxy

Entry1Entry2 Entry n...ServiceServiceproxyproxy

Lookup

Lookup Service

ProxyProxy Lookup?

??

proprietary

proprietary

protocol

protocol

Client

Entry1Entry2 Entry n...ServiceServiceproxyproxy

Page 14: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 14

F. Ma. 30

Template Matching (Examples)

Entry E

matches

Template T2null null

Template T1

matches

Entry E

Template T3

does NOT match

Entry E

F. Ma. 31

Proxies

Proxy object is stored in the lookup service upon registration

serialized objectimplements one or more service interfaces

Upon request, stored object is sent to the clientas a local proxy of the service

client communicates with service implementation via its proxy: client invokes methods of the proxy objectproxy implementation hidden from client

Page 15: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 15

F. Ma. 32

Smart Proxies

Parts of or whole functionality may be executed by the proxy at the clientWhen dealing with large volumes of data, it usually makes sense to preprocess parts of or all the data

e.g.: compressing video data before transfer

Partition of service functionality depends on service implementer’s choice

client needs appropriate resources

ClientClient ServiceService

ProxyProxy Communication

ClientClient ServiceService

ProxyProxy Comm ication

F. Ma. 33

Leases

Leases are contracts between two partiesLeases introduce a notion of time

resource usage is restricted to a certain time frame

Repeatedly express interest in some resource:I’m still interested in X

renew lease periodicallylease renewal can be denied

I don’t need X anymorecancel lease or let it expirelease grantor can use X for something else

Page 16: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 16

F. Ma. 35

Distributed Events

Objects in a JVM can register interest in certain events of another object in a different JVM“Publisher/subscriber” model

Subscriber Eventsource

1. Registration

2. Event occurs

3. Send notification

F. Ma. 36

Distributed Events – Example

Example: printer is plugged inprinter registers itself with local lookup service

Maintenance application wants to update softwareLookup-Service

Maintenanceapplication

Any protocol

Proxy,attributes

Proxy,attributes

Proxy,attributes

Page 17: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 17

F. Ma. 37

Maintenance application is run on demand, search for printers is “out-sourced”

“sensor service” looks for certain services on behalf of the maintenance applicationapplication registers forevents showing the arrivalof certain types of printerssensor observes thelookup servicenotifies application as soon as matching printer arrivesvia distributed events

Lookup-Service

Maintenanceapplication

Sensorservice

Tell me about the arrival of new printers of type x!

Distributed Events – Example

F. Ma. 38

Example: printer arrives, registers with lookup serviceprinter performsdiscovery and joinsensor finds newprinter in lookupservicechecks if thereis an event registrationfor this type of printernotifies allinterested objectsmaintenanceapplication retrievesprinter proxy and updates software

Lookup-Service

Maintenanceapplication

A new printer arrived.I have to notify allinterested objects!

Notification

Sensorservice

Proxy,attributes

Proxy,attributes

Distributed Events – Example

Page 18: Pervasive Computing / Ubiquitous Computing DIA …Pervasive Computing / Ubiquitous Computing DIA Nov. 04 © F. Mattern / M. Welsch 2 F. Ma. 3 Infrastructure (“middleware”) for

Pervasive Computing / Ubiquitous Computing DIA Nov. 04

© F. Mattern / M. Welsch 18

F. Ma. 39

Jini Issues and Problem Areas

Securityimportant especially in dynamic environmentsservices use other services on behalf of the user

principals, delegationwhat about charging for services?

rely on Java security ?Scalability

does Jini scale to a global level?Java centricSimilar, non-Java-based systems

UPnP, Bluetooth SDP, SLP, HAVi, Salutation, e-speak, HP Chai,...open, Internet-scale infrastructures (e.g., Web services)