Phase 3: Build a Single Server Key-Value System

In Phase 3 of your class, you will implement a Key-Value Store that runs on a single node on Amazon EC2. As in phases 1 and 2, you will submit an initial design document and a final design document apart from the code itself.

Architecture Diagram

Skeleton Code:

The project skeleton you should build on top of is posted at https://github.com/CS162Berkeley/Project3Skeletion. If you have git installed on your system, you can run git clone https://github.com/CS162Berkeley/Project3Skeletion.git, or else you can download the tarball from here. You can define additional classes and methods as you deem fit.

EC2 instructions:

Read the instriuctions carefully from this document regarding instantiation, operation, and termination of EC2 instances. As always, let us know in Piazza if anything is unclear.

Requirements:

Tasks (weightage / approximate lines of code):

  1. (10% / 15 loc) Set up your EC2 accounts, launch a machine, log into the machine. Create a program called PingPong that uses TCP Sockets to listen for connections on port 8081. The program should service each incoming TCP request on the socket with the string 'pong' (without the quotes).
  2. (30% / 150 loc) Implement the KVClient class that you are provided with, such that it will issue requests and parse responses in the appropriate format. You will implement the message parsing library in KVMessage. The client is responsible for marshalling and unmarshalling the keys and values.
  3. (15% / 50 loc) Implement a threadpool -- you are not allowed to use existing implementation of threadpools. The thread pool should accept different tasks and execute them asynchronously. The threadpool should maintain a queue of tasks submitted to it, and should assign it to a free thread as soon as it is available. Ensure that the addToQueue interface to the threadpool is non-blocking.
  4. (15% / 50 loc) Implement a thread safe fully-associative LRU cache. The cache should be instantitated with a parameter that specifies the size of the cache.
  5. (30% / 150 loc) Implement the Key-Value server which uses the threadpool to parallelize data storage into the dummy storage system provided to you (KVStore). Use the LRU Cache you implemented to make key lookups faster. You should follow a write-through caching policy.

Your Key-Value server should support the GET/PUT/DELETE interface with the following format:

Possible Error Messages (error messages are case sensitive):