Skip to content

pawanpraka1/load_balancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compile the server :-

step 1:

cd server
make clean
make

step 2:

Now in server/server.conf put the ip and port entries for the backend servers

127.0.0.1 8888
127.0.0.1 9999

step 3:

Now run the server which will listen on 7842 port for all load balancing request.
./server

There are test backend server and client code in the test directory. 
The server and client with keep sending the data to each other forever.

Backend server can be run using following command :-

cd test
make
./myserver -p <port> -s <send string>

it will listen on the given port(default 8888) and send <send string> to the client(default "How are you?\n").

step 4:

Start the test backend server (make sure you have mentioned the correct port in server/server.conf)

./myserver -p 8888 -s test1
./myserver -p 9999 -s test2

If backend server is already running then just update the server.conf with the appropriate ip and port and skip this step.

step 5:

Then send the request to this server on 7842 port. It will load balance the requests
among the servers listed in the server.conf using the round robin policy.

for test backend server, you can run test client in test directory.

./myclient

you can kill and restart this to verify next time the request is going to the next backend server in round robin manner.
You can also run multiple myclient to see each time it is switching the backed server.

If you have your own client then run it to send the request on 7842 port to the lb server started in step 3.

Debug Info:

If you want to check stats which is a debug info, go to the stats directory

cd stats
make clean
make

and then to check the stats do :-

./stats

About

application layer load balancer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published