What is RMI?
RMI: RPC mechanisms applied to OO model in Java - communication instances represented as objects - reference/parameter semantics supported - calls in general synchronous - asynchronous calls with Threads - RMI Registry as Naming Service
Explain a Java RMI call
1: Invocation by Client 2: Server Product Catalogue responds with reference parameter 3: Loading class info 4: invocation of Server Product 5: response from SP to Client
Compare RMI to RPC.
RMI is Object Oriented -> advantages of OO, varying granularity, reference parameter semantics, Java: Portability, Garbage Collection
What are Java Futures?
Futures represent a future result of an asysnchronous computation -> delivered by asynchronous RPCs
What are threads and how can you handle parallel calls with them?
Threads: process includes at least one thread, common address space, fast creation parallel calls: invoked by clients, handling by servers with multiple threads, waiting/idling
Compare Threads and Futures.
Integration LevelLow LevelHigh, Programming Language FlexibilityHighLimited to java mechanisms TypingNot supportedStrictly typed Result Checks Embedded in call thread or explicitly in main thread Cyclic checking in main Thread Developer Effort High,explicit thread handling Low, embedded, threads encapsulated
What is the RPC interaction scheme?
RPC interaction scheme: request/response
Explain publish/subscribe
2 roles: consumer, supplier; supplier publishes messages to consumer based on topic
Name advantages of publish/subscribe (to Request/result)
Strictly boundloosely coupled (easy rebinding) Inherently synchronousAsynchronous (handles disconnects better) 1:1n:m Familiar interaction schemeSimple interaction scheme Client and server are synchronizedSync required Error semantics neededReliability through message queues Client/server systemLoad balancing / parallelization
What is a message queue?
messages queue up in channel and get transferred to sender/receiver
Perks of messaging?
messaging: +: manageable, robust, flexible application, relevant for loose coupling -: limited comm semantics, limited accessibility of higher services
What is a stream?
sequence of time dependent audio and video packets
What classes are there for stream based communication?
classes: Unidirectional(on-Demand + Live), Bidirectional (point-to-point + multiconference)
Name and explain the phases of stream based communication.
connection establishment, usage and reaction to changes, connection closure
Name and explain stream based communication protocols
SIP (Session Initiation), RTP (Real Time Transport), RTCP (Real-Time Control) SIP: User Agent Client + User Agent Server RTP: Transfer of stream data in form of packets RTCP: dynamic flow control of RPC Connection
Name RPC system examples!
Ajax, WebServices (SOAP, WSDL)
compare RPC-, message- and stream-based communication!
CouplingSynchronous (through ext. asynchronous)AsynchronousIsynchronous Comm directionBidirectionalUnidirectionalUni and bidirectional Transported dataProcedure calls -> Request/Response Messages -> Publish/SubscribePeriodic data streams Abstraction levelHigh (calls embedded in programming l.Medium (separated programming model)Low (special programming int.) InteroperabilityHigh (IDL ind. progr. l.)To some extent (JMS)High (SIP, RTP,…) Mass data transferSupported(extensions)Well supportedIsynchronous stream
State fundamental properties of transactions
Atomicity Execution complete or without impacts Consistency Transformation between consistent states Isolation No overlapping of concurrent transaction executions Durability Survival of system failures due to persistent storage
What is a Two-Phase-Commit Protocol and how does it work?
2PC:coordinates processes that participate in distributed transaction ->prepare,ready,commit
Describe different reactions to failures of participants!
Coordinator fails: participants timeout after sending ready/abort - restart coordinator, co. recovers TA state, resends prepare, participants answer Participants fails after ready: co. sends commit to all pa.(releases locks, discards results) - pa restarts, asks coordinator for TA state, concludes TA
what is optimistic/pessimistic concurrency control?
Optimistic: rare conflicts, undo cheaper than blocking of Tas, no locks set pessimistic: frequent conflicts, rollback expensive, locks set
name and explain 2 different Two-Phase-Locking algorithms
simple TPL: lock release as soon as access finished strict TPL: locks only released at end of TA
Name the responsibilities Resource Managers, Transaction Managers and Application Programs!
AP:executes op on distributed resources, defines TA boundaries, begin/end, commit/rollback TM: manages ex. of TA, Middleware between AP and RM, 2PC, commit/reset RM: represents resources, executes TAs on resources
Explain nested transactions! Advantages?
Transaction in another Transaction Nested distributed transactions allow the fixing of partial results of transactions and therewith a fine grained resetting in the event of failures. •This is meaningful above all when transactions take a long time, and as the case may be contain complex operations, in order to retain the results of these operations as far as possible. •Partial results hard to achive(book flight) Moreover, partial transactions can be executed in parallel. •The same operations within a flat transaction would be processed sequentially
Why must, in the case of nested distributed transactions, the locks of concluded partial transactions be kept in place until the conclusion of the whole encompassing transaction?
possibility of a rollback for concluded partial transactions, perhaps due to a failure -> can cause the rollback of the whole transaction If locksnot upheld through to the conclusion of the whole encompassing transaction -> other transactions could access the results of the partial transactions of other nested transactions and modify these results If successfully concluded partial transactions then rolled back -> cascade of rollbacks, no Isolation
What does a distributed Transaction do?
Integrates operations on objects/data residing on multiple servers into an atomic operation/transaction
What additional mechanisms are required to handle distributed transactions?
Additions/Extensions •Coordination of multiple servers •Distributed Concurrency Control/Locking mechanisms -> Distributed deadlock handling •Handling of transaction context in distributed manner •Distributed transaction completion–commit protocol
How does the protocol react to the failure of the coordinator after sending the “Prepare“ message?
•At Participants timeout after sending „Ready/Abort“ •Restart coordinator •Coordinator recovers transaction state, resends „Prepare“ •Participants answer
Whatisa thread?
•Lightweight process o common address space ofast creation and process switching o large number of processes possible -> use in RPC-Server -implementations -> use in Client, too -> asynchronous •Process/Thread assignment o process creation per call or o process –Pool
Durch welche Phasen läuft der optimistic Approach Concurrency?
Work Phase Datenzugriff ohne Locks Read-Set –data objects involved in transaction Write-Set –changes made to the Read-Set Validation Phase Kontrolliert ob Read-Set inkonsistente Daten enthält, zB. durch eine andere Transaktion Ist dies der Fall wird die Transaktion abgrebrochen und die Änderungen rückgängig gemacht Securing Phase Write-Set wird an die Datenbank commited Passiert in einer Verteilten Transaktion durch das 2-Phasen Protokoll