- Clone this repo, run
npm install
. - Install redis and run on localhost:6379
- main.js
main.js is the main program which takes a port number as input.
Initially, an app server listens at the given input port number.
Run it as: node main.js 3001 - package.json npm install will install all the required dependencies for the main.js program listed in the package.json file.
- img
This folder has images which are used in the demo.
/set sets a new key with the value "this message will self-destruct in 10 seconds"
Key expires in 10 seconds.
/get fetches the value of the key and sends it to the client.
/recent stores the most recent 5 sites visited, and returns that to the client.
/upload stores all the uploaded images in a queue.
/meow displays the most recent image to the client and removes the image from the queue.
/spawn creates a new app server running on a new port and stores the new app server URL in a list.
/destroy selects a random server from the list of available server and removes it from the list and server is not used to handle any requests.
If only one server is available in the list of active servers then this server cannot be destroyed.
All the available servers are stored in redis queue.
/listservers displays all the servers in this queue.
Requests made on the proxy server port is uniformly distributed among all the available servers in a round robin fashion.
![Alt](https://github.ncsu.edu/psjawale/HW3/blob/master/screenshots/proxy server.png "proxy")
YouTube link