In: Computer Science
Consider a client-application that collects and computes the average of an integer (eg. stock price/value) collected from a number (eg 20) remote servers.
Question 1.
Determine how long time it will take the client to deliver an answer to its user, assuming serial requests to each server, and 1) an average response time of 200 ms, 2) 10 ms, and 3) 1 ms.
Question 2.
Compare this to the situation where all values are present in the local memory of the client.
Question 3.
What consequences does that have on the information that one computer of a distributed systems knows about the others?
Question 4.
What consequence does it have on the way we design a distributed system, and make use of remote access?
1. Assuming the worst case 200 ms for each server if we execute the REST API - jersey or rxnetty aynchronous non blocking api call in parallel - 4 threads since a processor has 4 cores at minimum - 20 remote servers / 4 threads => 5 servers / Thread
Each thread takes => 200 ms * 5 => 1000 ms => 1 second response times for 5 servers in each thread.
Together 4 threads we have -> 1 second * 4 => 4 seconds .
Assuming serial requests to server -> 200 ms * 20 => 4000 ms => 4 seconds .
2. Local memory -> RAM of the client is extremely fast sub-millisecond response time if in main memory it will happen based on the disk seeks. for 1 TB harddisk it will take less than 100 ms for data fetch.
3 & 4 . In case of distributed systems - we could access the values based on rpc or remote procedure call or REST API. Get method of rest api is faster.
Issues faced:
1.Client timeouts - because network is congested with heavytraffic or remote server is busy processing other requests.
2. API Retry or 404 error - HTTP status returning error codes due to bad gateway or server is down due to main memory failure or os crashes.
3. Server Down - 99.999% has 3 days down time . Trying to access at those time will lead to server not found error.
4. DNS error - DNS cache or DNS busy trying to process more requests.
5. Service Discovery Error - The URL is not found in the load balancer routing table or entry map .