A gRPC-based implementation of a wallet client and server. The wallet server keeps track of a user's monetary balance in the system. The client emulates users performing deposit and withdrawal transactions.
Once you have cloned the project, execute the following steps:
Get the Postgres Docker image:
docker pull postgres
Start the Postgres container:
docker run --rm --name postgres-docker -e POSTGRES_PASSWORD=b3tp4w4 -d -p 5432:5432 postgres
Run the Postgres script to create and populate the DB. In the terminal, run the following command from the project's root:
psql -h localhost -U postgres -f src/main/resources/wallet-schema.sql
Then, enter the password from the previous step: b3tp4w4
- From the project's root, generate builds for the server and the client:
./gradlew installDist
- Run the server:
Currently, the best option to run the server is through IntelliJ. Right click on WalletApplication and then click on run. Using this option the server will run faster.
Alternatively, the server can be started using the following command from project's root.
./build/install/betpawa-wallet/bin/wallet-server
This option runs slower, so the first option is recommended.
- In another terminal, run the client:
./build/install/betpawa-wallet/bin/wallet-client -u <num_users> -t <num_threads> -r <rounds>
Where:
-r,--rounds <arg> number of rounds each thread is executing
-t,--threads <arg> number of concurrent requests a user will make
-u,--users <arg> number of concurrent users emulated