Exercises: Client-Server vs. Ring


Before asking questions regarding this exercise, please review the lecture notes of Week #01 and #02 as well as the documentation on the Erlang web pages.

Client-Server vs Ring

In Erlang implement a simple key-value database (similar to the address server from exercise 1) according to a client-server architecture. The server stores the data and receives simple insert and lookup requests from clients.

Evaluate the scalability of this system.

Write a simple benchmark that fills the server up with many key-value pairs, then starts a given number of clients that continuously send requests to the server. Measure how long it takes for the server to process the requests. Progressively increase the number of clients until the server is overloaded. Note, it will make most sense to run the clients on separate machines from the server, you can do this on vina.

Implement a similar database, but using a ring architecture. The job of the server is now distributed over multiple nodes that will communicate in a ring (i.e., each server only directly communicates with two neighbours). Key value pairs are distributed throughout the ring (i.e., each server only stores a part of the whole database). Each client sends its requests to a single server. Upon receiving a request a server can either fulfil it locally or pass the request on to its neighbour.

Benchmark this system in a similar way to the client-server system. Once again it makes sense to run the servers on different machines. Depending on how many servers you have it may be necessary for the clients to run on the same machines as the servers.

How does the client-server architecture compare to the ring.

Can you think of a more sophisticated and scalable design for the ring?

Note: when running programs on vina, make sure to clean up after yourself! Make sure to kill any leftover processes you have on all the nodes before logging out.

This page is maintained by cs9243@cse.unsw.edu.au Last modified: Monday, 07-Sep-2020 22:07:44 AEST