This project is a multi-threaded key-value store implemented using Remote Procedure Calls (RPC). The server can handle concurrent requests from multiple clients, allowing for efficient PUT, GET, and DELETE operations on key-value pairs. The project aims to demonstrate the implementation of synchronization techniques to manage concurrent client access and ensure data consistency.
- Java Development Kit (JDK): Version 11 or higher
- Docker: Version 20.10 or higher (for containerizing server and client components)
Follow these steps to get the project up and running on your system:
$ git clone https://github.com/yourusername/multi-threaded-kv-store-rpc.git
$ cd multi-threaded-kv-store-rpcBuild Docker images for both the server and client components.
$ docker build -t kv_server -f Dockerfile.server .
$ docker build -t kv_client -f Dockerfile.client .Create a Docker network to allow communication between the server and clients.
$ docker network create kv-networkStart the server container, attaching it to the Docker network.
$ docker run --name kv_server --network kv-network -d kv_serverRun multiple client containers to test the concurrency of the key-value store.
$ docker run --name kv_client1 --network kv-network -d kv_client
$ docker run --name kv_client2 --network kv-network -d kv_client
$ docker run --name kv_client3 --network kv-network -d kv_client
$ docker run --name kv_client4 --network kv-network -d kv_client
$ docker run --name kv_client5 --network kv-network -d kv_clientTo verify the server's performance and see the operations being processed, check the server logs.
$ docker logs kv_server- The server handles PUT, GET, and DELETE requests from multiple clients concurrently.
- Each client performs 5 PUT, 5 GET, and 5 DELETE operations.
- The server logs each request, showing which client made the request and whether it was successful.
- Concurrency Handling: The server uses synchronization techniques to handle multiple concurrent client requests without data races.
- Docker Containerization: The use of Docker ensures that the server and clients can run in isolated environments, making setup easy and consistent.
- Scalable Design: The server can handle multiple clients, demonstrating its scalability in a distributed environment.
- Port Already in Use: If you encounter an error like
Port already in use, ensure that no other process is using the default RMI port (1099). You can stop any existing server container or change the port number. - Connection Refused: Ensure that the Docker network is correctly set up and that both server and client containers are attached to the same network.
To stop and remove all containers:
$ docker stop kv_server kv_client1 kv_client2 kv_client3 kv_client4 kv_client5
$ docker rm kv_server kv_client1 kv_client2 kv_client3 kv_client4 kv_client5To remove the Docker network:
$ docker network rm kv-networkThis project is licensed under the MIT License.
- Inspired by distributed systems concepts and RPC mechanisms.