______ ___ ______ _________ _________________
___ |/ /_____ _______ ___ _____________ ___________ /_ _____ ______ / ______ /__ ___/
__ /|_/ / _ _ \__ __ `__ \_ ___/_ __ `/_ ___/__ __ \_ _ \_ __ / ___ _ / _____ \
_ / / / / __/_ / / / / // /__ / /_/ / / /__ _ / / // __// /_/ /___ / /_/ / ____/ /
/_/ /_/ \___/ /_/ /_/ /_/ \___/ \__,_/ \___/ /_/ /_/ \___/ \__,_/ _(_)\____/ /____/
Memcached.js is a port of Memcached to Javascript, running on Node.Js.
$ git clone git://github.com/dalssoft/memcached.js.git $ cd memcached.js $ ./bin/memcachedjs
From the original project:
"Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering."
This version:
Memory for an item is not actively reclaimed. If you store an item and it expires, it sits in the LRU cache at its position until it falls to the end and is reused.
However, if you fetch an expired item, memcached.js will find the item, notice that it's expired, and free its memory. This gives you the common case of normal cache churn reusing its own memory.
Items can also be evicted to make way for new items that need to be stored. But before that, we will try to drop a few expired items at the end of the list.
Currently, the project is Alpha (version 0.0.4), not tested in production enviroment. However, it was tested using diferent scenarios and condition, with different clients (see /test/from_clients folder and the list below).
I haven't done any serious performance test, just simple ones. Compared with the original memcached written in C, memcached.js performance is between 30% and 50% slower. The situation may worsen as new functionality is added (currently, it's ~ 1000 of javascript LOC against ~ 7500 of C LOC, according to CLOC). At the same time, it can be improved since no optimization has been done yet and I can see many places where it could do better.
Tested on Node.js since version v0.3.6-pre. Last check: Node.js v0.10.5
Clients tested:
C/C++:
Ruby:
Node.js:
Perl:
$ cd memcached.js $ ./bin/memcachedjs --log 1
On the client side:
$ telnet localhost 11211 stats
Test:
$ rspec -fd -c test/from_clients/ruby_spec_test.rb
ASCII Bin
Get X X
Set X X
Add X X
Replace X X
Delete X X
Increment
Decrement
Quit
Flush X X
GetQ
No-op X
Version X
GetK
GetKQ X
Append
Prepend
Stat X
SetQ
AddQ
ReplaceQ
DeleteQ
IncrementQ
DecrementQ
QuitQ
FlushQ
AppendQ
PrependQ