-
Notifications
You must be signed in to change notification settings - Fork 3
Experiments
This page will contain examples of how to run the system to clearly observer some of its most interesting features regarding distributed systems.
Render a simple map with four dragons and one client. Just to demonstrate the structure and functionality of the game and client.
$ python3.6 -m server.app --users ./test/das_map.json --vis
$ python3.6 -m client.app --vis
Create the real map with 20 dragons. Spawn 50 clients from the command line tool.
$ python3.6 -m server.app --users ./test/das_hell.json --vis
$ python3.6 -m test.console_control
$ client.init 50
% [in a new terminal]
$ python3.6 -m client.app --vis
$ client.killall
We will spawn 2 servers in a separate terminal and two clients, one for each. Note that the second client will be connected to the server with no client automatically. (Load Balancing) Have all terminals be in --vis mode and check the synchrony of everything.
% [Server1]
$ python3.6 -m server.app --users ./test/das_map.json --vis --config ./test/das_dist.json
% [Server2]
$ python3.6 -m server.app --vis --config ./test/das_dist.json
$ client.init 10
% [In different terminal]
$ cat log/client_1.log
$ cat log/client_2.log
% [Kill server1]
$ server.kill 1
% [All clients will be connected to Server2]
Note client 1 is connected to one server and the other one to another server.
We will spawn 5 servers and 100 clients using the CLI tools. We will add another client just to demonstrate the actions taking place. Once the game is over, we compare the logs of all servers.
$ python3.6 -m test.console_control
$ server.init 5
$ client.init 100
$ python3.6 -m client.app --vis
server.status
$ client.killall
% [Kill the last client]
$ server.killall
$ ./test/compare_logs.sh log/server_1_game.log log/server_2_game.log
...
To check to the size of log files:
ls -lah log/server_*
We will spawn two servers and distribute 10 clients among them. The clients should be somehow evenly placed. Next, we will spawn a third server and further demonstrate that servers attempt to migrate clients to the new server. For Fault-Tolerance, we kill the new server again and see how clients that were attached to it are now migrated back to the original server.
% TIP: Reduce Dragon.ap to 1 from common/user.py
$ python3.6 -m test.console_control
$ server.init 2
$ client.init 10
$ server.status
$ server.start 3
$ server.status
$ client.status
$ server.kill 3
$ server.status
$ client.status
Note that this demo demonstrates Fault-Tolerance, Load Balancing, and Consistency with logs.
We run a single server with 5 normal clients. A malicious client is added. First, we see how the new client is not ablr to do anything becasue all of its commands are rejected by the server. Second, the logs can be seen to further see this.
$ python3.6 -m test.console_control
$ server.init 1
$ client.init 5
$ python3.6 -m client.app --vis --malicious
Search logs and find ERRORS like:
2017-12-06 13:09:55,502 game.command ERROR :: Command AttackCommand(type=AttackCommand, timestamp=1512562195.01635, client_id=1d8b3078e8477e8f52d847e25751fc36, target_id=d13568c6f75f3ebf39ade2755954972f, user_id=1d8b3078e8477e8f52d847e25751fc36) failed. Can't attack users
2017-12-06 13:11:51,503 game.command ERROR :: Command MoveCommand(type=MoveCommand, timestamp=1512562311.233109, client_id=1d8b3078e8477e8f52d847e25751fc36, value=10, direction=h)[value 10 direction h] failed. Invalid step count