cucache

module
v0.0.0-...-030ecf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2015 License: MIT

README

cucache

Fast PUT/GET/DELETE in-memory key-value store for lookaside caching.

Build Status

A mostly complete implementation the memcache text and binary protocols can be found inside cucache. The binary protocol has been tested using memcached-test, and the text protocol with simple test cases extracted from the protocol specification.

The implementation uses Cuckoo hashing along with several concurrency optimizations. The implementation uses much of the code from Dustin Sallings' gomemcached for the binary protocol.

Known limitations and outstanding things

  • Needs configurable debugging information output
  • The touch command is not implemented; see dustin/gomemcached#12
  • Protocol should be tested against mctest

Current implementation notes can be found in wip.md.

Want to use it?

Great! Please submit pull-requests and issues if you come across anything you think is wrong. Note that this is very much a WIP, and I give no guarantees about support.

Why another memcached?

Cuckoo hashing is cool, and fast. Go is cool, and fast. Maybe the two can outcompete the aging (though still very much relevant) memcached while keeping the code nice and readable. Furthermore, as the Go runtime improves over time, cucache might itself get faster automatically!

The hope is that fine-grained write locking and lock-free reading might speed up concurrent access significantly, and allow better scalability to many cores. While the traditional memcached wisdom of "just shard your data more" works well most of the time, there comes a point where you have some single key that is extremely hot, and then sharing simply won't help you. You need to be able to distribute that keys load across multiple cores. Although memcached does support multi-threaded execution, the fact that it locks during reads is a potential scaling bottleneck.

Experimental results

cucache is currently slightly slower than memcached in terms of over-the-network performance simply due to Go being slower than C for many operations: network socket operations have more overhead, system calls are slower, request and response marshalling is slower, and goroutine scheduling and GC incur additional runtime cost. In terms of pure performance (i.e. direct hash table operations), cuache is probably significantly faster than memcached already.

See benchmark/ for more in-depth performance evaluation.

Directories

Path Synopsis
src
cuckood
package cuckoo provides a Memcache-like interface to a concurrent, in-memory Cuckoo hash map.
package cuckoo provides a Memcache-like interface to a concurrent, in-memory Cuckoo hash map.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL