A Java/Gradle distributed systems project that implements a TCP client/server time-series sales database. The server accepts framed requests from multiple clients, stores sales events by day, and supports aggregate queries over recent sales data.
The project also includes a console client and a workload runner for basic performance experiments.
- User registration and authentication.
- Product sales event registration.
- Daily time-series storage for sales events.
- Aggregate queries:
- number of sales for a product;
- total sale volume for a product;
- average sale price;
- maximum sale price;
- filtered event lookup by day and product list.
- Blocking queries for concurrent and consecutive product sales.
- Sharded user and product/event management to reduce contention.
- Binary framed client/server protocol over TCP.
- Java 21.
- Gradle 9.2.1, or the included Gradle wrapper.
The repository includes .tool-versions for environments managed by asdf.
Use the Gradle wrapper from the repository root:
./gradlew buildRun the standard test task:
./gradlew testStart the server first:
./gradlew server -Pargs=1,40,10,40The server listens on port 12345 and expects four arguments:
<user-shards>,<product-shards>,<s>,<d>
Where:
user-shardsis the number of shards used for user storage.product-shardsis the number of shards used for product/event structures.sanddare parameters passed to the time-series manager.
In a second terminal, start the interactive client:
./gradlew clientThe client connects to localhost:12345 and prompts for registration or login. After authentication, it exposes operations for registering events, running aggregate queries, starting a new day, and exiting.
With the server running, start the workload runner:
./gradlew testsThe runner connects to localhost:12345, registers a default user, and prompts for one of these workloads:
- Insert 1000 events.
- Query sale volume for 40 products over 10 days.
- Query filtered events for 10 different days.
Some workloads generate response-time charts using JFreeChart.
./gradlew build # Compile, test, and package
./gradlew test # Run JUnit tests
./gradlew server # Start the server with default args if none are provided
./gradlew client # Start the interactive console client
./gradlew tests # Start the custom workload runnerThis project is licensed under the terms in LICENSE.