Skip to content
nunom27Public

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

SD

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.

Features

  • 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.

Requirements

  • Java 21.
  • Gradle 9.2.1, or the included Gradle wrapper.

The repository includes .tool-versions for environments managed by asdf.

Build

Use the Gradle wrapper from the repository root:

./gradlew build

Run the standard test task:

./gradlew test

Run

Start the server first:

./gradlew server -Pargs=1,40,10,40

The server listens on port 12345 and expects four arguments:

<user-shards>,<product-shards>,<s>,<d>

Where:

  • user-shards is the number of shards used for user storage.
  • product-shards is the number of shards used for product/event structures.
  • s and d are parameters passed to the time-series manager.

In a second terminal, start the interactive client:

./gradlew client

The 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.

Workload Runner

With the server running, start the workload runner:

./gradlew tests

The runner connects to localhost:12345, registers a default user, and prompts for one of these workloads:

  1. Insert 1000 events.
  2. Query sale volume for 40 products over 10 days.
  3. Query filtered events for 10 different days.

Some workloads generate response-time charts using JFreeChart.

Useful Gradle Tasks

./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 runner

License

This project is licensed under the terms in LICENSE.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages