Skip to content

ramachaitanyak/netflix-cached

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netflix-cached

A memcached like caching server

Introduction

The goal of this program is to create a high-performance concurrent memcached-like server. For the scope of this program, the following simplifications are made from a full implementation:

• Supports only the memcached text protocol
• Supports only the get and set operations
 * The flags, exptime, and (optional) noreply parameters are accepted but not used
• The only required configuration is for the TCP listening port or listen on 11211 port by default
• The get command can be for one key only if desired

Relevant Document References

Build & Test Instructions

* To build `netflix_cache_server`
  - cd ./source
  - make cache_server
* To remove any unecessary object files and the binary before rebuild
  - cd ./source
  - make clean

* To build the test_cache_client
  - cd ./test
  - make cache_client 
* To remove test client
  - cd ./test
  - make clean

NB 1: test_cache_client only works when there is a netflix_cache_server running. To run tests, please run netflix_cache_server first before running test_cache_client

NB 2: The release versions of netflix_cache_server and test_cache_client are compiled and pre-built for use

Usage

* Start cache server
  - ./release/netflix_cache_server [optional-port]
* Start the test client within 20 seconds on starting cache server
  - ./release/test_cache_client [optional-port]
  
Note: `./release/netflix_cache_server` is -O3 optimized and has produced better results in my performance measurements.

Data Size Limits

This project only supports text commands of maximum size 5120 bytes. The key can not have control characters and is limited to a size of 250 characters.

Performance Measurments

Tool used : 'memcslap' from package 'libmemcached-tools' on Ubuntu Linux memcslap

Usage
memcslap -s 127.0.0.1:11211 --concurrency=[1-8] --test=[get/set]

Experiment 1: 1 load generating client on the same node as the cache-server
10000 sets of 4096 bytes of unstrcutured data took 0.608 seconds approximately
10000 gets on those keys took 0.257 seconds approximately

Experiment 2: 8 load generating concurrent clients on the same node as the cache-server
79869 sets of 4096 bytes of unstructured data took 1.6 seconds approximately

These experiments are conducted on a VM with 8 cores.

To install memcslap on ubuntu please run `apt install libmemcached-tools`

Compatibility, Development and Test Environment

Linux Version used for Development and Test

Linux vm-2997079 4.4.0-143-generic #169-Ubuntu SMP Thu Feb 7 07:56:38 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

g++ compiler version

Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1)

NB: The minimum requirement to build the project is to have a gcc version of 7 or higher; please update g++ if running into any errors

Upgrade Instructions

References

xxHash - Non cryptographic hashing algorithm used for hashing

Memcached text protocol

Thread pool design patterns

C++ Draft

About

A memcached like caching server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published