-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
65 lines (39 loc) · 1.62 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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