Lecture 31: Remote Proxying
The lecture is a brief introduction to turning a monolithic system into a distributed one using the remote proxy pattern.
|
|
|
Server Client
| |
| |
| ding('ping) | ping the client
| -----------------> |
| N | the client returns
| <================= | a strictly increasing
| | sequence of naturals
| |
| |
| |
| dong('pong) | pong the client
| -----------------> |
| N |
| <================= |
. .
. .
. .
| dong('pong) |
| -----------------> |
| N |
| <================= |
| | Stop when result >= 10
----- ----
(define (monolithic-launch) (define client (new client%)) (define server (new server% [client client])) (send server go) "all done")
Now imagine we would like to distribute this system across two different machines. That is, the server and the client no longer run in the same program (or even on the same machine), but in two different places. One way to imagine this goal is to cut the method calls between the two, as in figure 2.
Server Client
| |
| |
| ding('ping) | ping the client
| ----------------- ---> |
| N | the client returns
| <================ ==== | a strictly increasing
| | sequence of naturals
| |
| |
| |
| dong('pong) | pong the client
| ----------------- ---> |
| N |
| <================ ==== |
. .
. .
. .
| dong('pong) |
| ----------------- ---> |
| N |
| <================ ==== |
| | Stop when result >= 10
----- ----
| dong('pong) | |
| ----------------- ~~~~~~~~~~~~~~~ ---> | |
| N | |
| <================ ~~~~~~~~~~~~~~~ ==== | |
one that replaces and simulates the client on the server side;
another one that replaces and simulates the server on the client side.
Server ClProxy SeProxy Client
| | | |
| ding('ping) | | | ping the client
| -----------------> | ~~~~~~~~~~~~~~~~ | ---> |
| N | | the client returns
| <====-============ | <~~~~~~~~~~~~~~~ | <=== | a strictly increasing
| | | |
| | | | sequence of naturals
| dong('pong) | | | pong the client
| -----------------> | ~~~~~~~~~~~~~~ > | ---> |
| N |
| <================ | <~~~~~~~~~~~~~~~ | <=== |
| | | |
. .
. .
. .
| | | |
| dong('pong) | | |
| -----------------> | ~~~~~~~~~~~~~~~> | ---> |
| N |
| <================ | <~~~~~~~~~~~~~~~~ | <=== |
| | Stop when result >= 10
----- ---
|
|
|
|
|
|
Puzzle When should the client really shut down?
Resources
09:15am
Presenters: Adam Melhuish, Gabrielle Bruck |
|
Head Reader: Jaana Tabalon |
Assistant Reader: Graham Preston |
Secretary: Jake Howard |
01:35pm
Presenters: Anmol Sakarda, Hunter Fingado |
|
Head Reader: Cameron Scoons |
Assistant Reader: Samuel Richards |
Secretary: Benjamin Knower |
Presenters: Benjamin Blaustein, Elijah Olson |
|
Head Reader: Stephen Jayne |
Assistant Reader: Yuheng Dong |
Secretary: Jason Enright |
04:35pm
Presenters: Ken Zou, Robert Yin |
|
Head Reader: Jacob Chvatal |
Assistant Reader: Sean Pomerantz |
Secretary: Christian Yiu |
Presenters: Kyle Posluns, Michaela Perrotta |
|
Head Reader: Harshal Nawade |
Assistant Reader: Thomas Sarni |
Secretary: Zain Aaban |