KEMBAR78
RPC in Smalltalk | PDF
RPC in Smalltalk
Annick Fron
http://www.afceurope.com
http://www.fencingfox.com
7/22/19@ AFC Europe - ESUG 2019 1
Distributed applications
7/22/19@ AFC Europe - ESUG 2019 2
Dunod 2015, 3rd
edition
Java Distributed
Architecture
Software consultant,
not academic
8 fallacies in Distributed Computing (Peter Deutsch 1994)
•
The network is reliable : redundancy, intermediate storage
•
Latency is zero : 30s for light between US and Europe ; latency using Ajax
•
Bandwidth is infinite : packets are limited in size
•
The network is secure : must understand firewalls, passwords,etc.
•
Topology doesn't change : endpoints, alias, abstract naming, host names...
•
There is one administrator : monitoring, interoperability contracts
•
Transport cost is zero : routers, servers...
•
The network is homogeneous : try to stick to standards
7/22/19@ AFC Europe - ESUG 2019 3
The Smurfs
HTTP,
Cloud,
Relational
database
RPC is hard : all weapons welcome!
7/22/19@ AFC Europe - ESUG 2019 6
Sockets : don't understand objects !
● UDP
● Allows broadcast
● Limited size messages
● Faster (no handshake)
● Used by video
● TCP
● More “reliable” because of
handshake... but less tolerant to
network disconnection
● Used by HTTP
Swiss Army
knife for ANY
language !
RPC ?
•
Remote Procedure Call
•
Remote events
•
Data sharing
•
Streaming and web sockets
•
Remote notification
•
And then non functional properties : redundancy, security, reliability, resource pooling...
7/22/19@ AFC Europe - ESUG 2019 8
RPC
● Contact point : URL, registry key, endpoint(web service);
– extensions to pool of workers or security policies
● Transport : TCP, UDP, HTTP, MQ ...
● Marshalling/unmarshalling
Marshalling/unmarshalling
Sockets are flat
•
ASN1, CDR
•
JSON
•
XML
•
Fuel, SIXX, BOSS
•
Object
references
•
7/22/19@ AFC Europe - ESUG 2019 10
Naive ideas
● Using doesNotUnderstand for proxies to modify behaviour
● An object is always able to perform a selector passed as a string
Passing by reference / by value
● Reference
● Easy for large objects
● May imply handling distributed GC
● Client and server in sync
● Ping pong effect for nested objects
● Implies a registry to one or more
root references
● Value
● Client may work independently, but
looses sync on server
● Large chunks being passed on the
network
Démo VW
Some questions
● Passing classes ? Passed by name. But a class in one instance is recognized as a
class in the other instance. This is not true in other languages Corba on C
requires mapping of vtables). In Java a class in a class loader is different from
the same class in another class loader, or in another memory space. Strong
typing is a looser across memory spaces
● Passing errors ? Errors raise errors on the distant image
● Instvars can have individual passing policies (or none)
Distributed events and broadcast
RPC in VW
● Pluggable transport : TCP, UDP
● Mapping to historical CORBA, IIOP : may call other languages like Java, C++ or C
● I3S provides transparent RPC with custom instvar policies (value, reference)
● Event service allows remote event notification
Seamless in Pharo
● Pass by reference or pass by value semantics
● Used for remote debug
● Initial reference : Whole environment
Both semantics supported
Object>>seamlessDefaultTransferStrategy
^SeamlessTransferStrategy defaultByReference
Number>>seamlessDefaultTransferStrategy
^SeamlessTransferStrategy defaultByValue
JRPC : using JSON for marshalling
Preparing an image for remoting
● Identify system objects (CairoContext, files, processes …) which can't pass
though
● Analyse the calling sequence to minimize ping pong : can require creating new
objects which are “summaries” of some other objects, like views in a database
● Decide on pass by value/ pass by reference
● Always release ressources
Web sockets
Wraps http request with handler
ZnServer default delegate: (ZnWebSocketDelegate handler:
[ :webSocket |
[ | message |
message := webSocket readMessage.
webSocket sendMessage: message ] repeat ]).
Web sockets
● Same issues as sockets : strings and byte arrays, no objects
● One web socket per page needs to be parsed to different fields
● Handling disconnections
Web services
● Marshalling: XML
● Endpoint : URL
● WSDL : IDL
● Transport : HTTP
● Copy semantics
● SOAP Envelope for non functional aspects (?)
Using Gemstone
● May use Gemstone as a distributed shared memory
● Objects are shared in the images
● But notification of change needed to update interface : use of notifySets with
the interface as a callback
● Use gemstone signalling between computers
Different notification mechanisms
● Using notifySets to update the GUI
session1 addToNotifySet: leTournoi competition poules first.
session1 notificationAction: [:idSet | callbacks do: ….].
● Using Gem to gem signalling for workflow
session gemSignalAction:
[:aSession :aSignalNumber :aString |
self handleSignalFrom: aSession number: aSignalNumber string: aString].
Conclusion
● Missing testing tools !
● MQTT, gRPC (Google)
● Streaming : mixing data and signals

RPC in Smalltalk

  • 1.
    RPC in Smalltalk AnnickFron http://www.afceurope.com http://www.fencingfox.com 7/22/19@ AFC Europe - ESUG 2019 1
  • 2.
    Distributed applications 7/22/19@ AFCEurope - ESUG 2019 2 Dunod 2015, 3rd edition Java Distributed Architecture Software consultant, not academic
  • 3.
    8 fallacies inDistributed Computing (Peter Deutsch 1994) • The network is reliable : redundancy, intermediate storage • Latency is zero : 30s for light between US and Europe ; latency using Ajax • Bandwidth is infinite : packets are limited in size • The network is secure : must understand firewalls, passwords,etc. • Topology doesn't change : endpoints, alias, abstract naming, host names... • There is one administrator : monitoring, interoperability contracts • Transport cost is zero : routers, servers... • The network is homogeneous : try to stick to standards 7/22/19@ AFC Europe - ESUG 2019 3
  • 4.
  • 5.
  • 6.
    RPC is hard: all weapons welcome! 7/22/19@ AFC Europe - ESUG 2019 6
  • 7.
    Sockets : don'tunderstand objects ! ● UDP ● Allows broadcast ● Limited size messages ● Faster (no handshake) ● Used by video ● TCP ● More “reliable” because of handshake... but less tolerant to network disconnection ● Used by HTTP Swiss Army knife for ANY language !
  • 8.
    RPC ? • Remote ProcedureCall • Remote events • Data sharing • Streaming and web sockets • Remote notification • And then non functional properties : redundancy, security, reliability, resource pooling... 7/22/19@ AFC Europe - ESUG 2019 8
  • 9.
    RPC ● Contact point: URL, registry key, endpoint(web service); – extensions to pool of workers or security policies ● Transport : TCP, UDP, HTTP, MQ ... ● Marshalling/unmarshalling
  • 10.
    Marshalling/unmarshalling Sockets are flat • ASN1,CDR • JSON • XML • Fuel, SIXX, BOSS • Object references • 7/22/19@ AFC Europe - ESUG 2019 10
  • 11.
    Naive ideas ● UsingdoesNotUnderstand for proxies to modify behaviour ● An object is always able to perform a selector passed as a string
  • 12.
    Passing by reference/ by value ● Reference ● Easy for large objects ● May imply handling distributed GC ● Client and server in sync ● Ping pong effect for nested objects ● Implies a registry to one or more root references ● Value ● Client may work independently, but looses sync on server ● Large chunks being passed on the network
  • 13.
  • 16.
    Some questions ● Passingclasses ? Passed by name. But a class in one instance is recognized as a class in the other instance. This is not true in other languages Corba on C requires mapping of vtables). In Java a class in a class loader is different from the same class in another class loader, or in another memory space. Strong typing is a looser across memory spaces ● Passing errors ? Errors raise errors on the distant image ● Instvars can have individual passing policies (or none)
  • 17.
  • 18.
    RPC in VW ●Pluggable transport : TCP, UDP ● Mapping to historical CORBA, IIOP : may call other languages like Java, C++ or C ● I3S provides transparent RPC with custom instvar policies (value, reference) ● Event service allows remote event notification
  • 19.
    Seamless in Pharo ●Pass by reference or pass by value semantics ● Used for remote debug ● Initial reference : Whole environment
  • 21.
    Both semantics supported Object>>seamlessDefaultTransferStrategy ^SeamlessTransferStrategydefaultByReference Number>>seamlessDefaultTransferStrategy ^SeamlessTransferStrategy defaultByValue
  • 22.
    JRPC : usingJSON for marshalling
  • 23.
    Preparing an imagefor remoting ● Identify system objects (CairoContext, files, processes …) which can't pass though ● Analyse the calling sequence to minimize ping pong : can require creating new objects which are “summaries” of some other objects, like views in a database ● Decide on pass by value/ pass by reference ● Always release ressources
  • 24.
    Web sockets Wraps httprequest with handler ZnServer default delegate: (ZnWebSocketDelegate handler: [ :webSocket | [ | message | message := webSocket readMessage. webSocket sendMessage: message ] repeat ]).
  • 25.
    Web sockets ● Sameissues as sockets : strings and byte arrays, no objects ● One web socket per page needs to be parsed to different fields ● Handling disconnections
  • 26.
    Web services ● Marshalling:XML ● Endpoint : URL ● WSDL : IDL ● Transport : HTTP ● Copy semantics ● SOAP Envelope for non functional aspects (?)
  • 27.
    Using Gemstone ● Mayuse Gemstone as a distributed shared memory ● Objects are shared in the images ● But notification of change needed to update interface : use of notifySets with the interface as a callback ● Use gemstone signalling between computers
  • 28.
    Different notification mechanisms ●Using notifySets to update the GUI session1 addToNotifySet: leTournoi competition poules first. session1 notificationAction: [:idSet | callbacks do: ….]. ● Using Gem to gem signalling for workflow session gemSignalAction: [:aSession :aSignalNumber :aString | self handleSignalFrom: aSession number: aSignalNumber string: aString].
  • 29.
    Conclusion ● Missing testingtools ! ● MQTT, gRPC (Google) ● Streaming : mixing data and signals