Load balancer for nanoTwitter, written in Node.js with Express.
The load balancer sits in front of all our microservices (reader 1, reader 2 and write service). It redirects all POST
requests to write service, and dispatches GET
service to one of reader 1, reader 2 and write service using a timestamp based hash function. The hash function favors reader 1 and reader 2 over write service since we want to save the resources on write service for POST
requests and database accesses.
To run the app:
cd
into the repo folder- Run
npm i
to install dependencies (this requires you to havenpm
installed) - Start app by
npm start
and visitlocalhost:3000
. Notice that you might need to start the read service and write service to make the app fully functional