- Open a terminal session in
/MyUber/server
, and runpython -m grpc_tools.protoc -I../protofiles/ --python_out=. --pyi_out=. --grpc_python_out=. q3.proto
. - To run the server, run
python server.py <server_port>
in the same directory. - Navigate to
build/
and run./MyUber_client <client_role> <load_balancing_policy> <num_servers> <server_port_1> <server_port_2> ...
to run the client.
client_role MUST NECESSARILY be one of rider or driver, and load_balancing_policy MUST NECESSARILY be one of pick_first or round_robin.
- Both; rider and driver are clients. The server is what facilitates the requests between the clients.
- There can be multiple servers, and each client can send a request only to a single server at any given time.
- Assuming that clients and servers don't just crash randomly.
- Each client knows of all the servers, and chooses a server to send a request to, while performing load balancing. (client-side load balancing)
- As C++ doesn't support custom load balancing yet, I am unfortunately unable to do implement custom load balancing. (see, bottom of: https://grpc.io/docs/guides/custom-load-balancing/).
- As load balancing is to be done, all the servers will share a common database to keep track of riders and drivers. They will not store the state of riders and drivers themselves.
- Assuming that a request gets cancelled if it gets rejected/ignored (timed out) by 3 drivers.
- CA certificate exists at the start, and each client/server creates its own SSL certificate on demand (based on its UUID), and gets it signed with the
ca.crt
. All these certificates are stored in thecertificate
folder. - I am using Redis for my database storage (in-memory). It has pub/sub events which I am making use of.
- The server which I am using will be asynchronous. The client itself however, is synchronous.
- LogAndAuthInterceptor is responsible for checking certificate expiry date as well, apart from acting as both; a logging and an authorization interceptor.
- All calls are logged, including those which were denied access.
- Accounted for race conditions while logging as well. Logs are stored in
.log
file in theserver
folder. - A rider can request multiple rides (say, for different people) but a driver can only take one ride at a time.