UMEM-CACHE is an user-space key/value in-memory cache.
We compared the performance and speed of UMEM-CACHE, MEMCACHED and REDIS with tests. In most tests, UMEM-CACHE shows better cache hit rate and less memory usage. In the test of caching small objects, UMEM-CACHE is about 20% faster than REDIS.
- 64bit linux
- linux 2.6.32 or later (not verified)
- 4k page size
- Go installed and 100MB memory is required for test
GCC is required for build.
config config.h as needed
cd umem-cache make make check ./umem-cache
or using c flags
cd umem-cache make EXTRA_CFLAGS="-DCONFIG_THREAD_NR=4 -DCONFIG_MAX_CONN=512 \ -DCONFIG_MEM_LIMIT=\"(100<<20>>PAGE_SHIFT)\" -DCONFIG_TCP_TIMEOUT=3000" make check ./umem-cache
config config.h as needed
cd umem-cache make debug ./umem-cache
see umem-cache-client-Go, includes functional tests, performance tests, benchmark tests and comparison information with MEMCACHED and REDIS.
Keys and values are arbitrary byte arrays, except key is at most 255 bytes.
We have built-in anti-dogpiling.
Dogpiling is the effect you get when a hot key first coming into the cache, and everyone rushes to cache it, which puts pressure on the fallback database. The anti-dogpiling tries to mitigate this by only let one connection have the permission to do the cache work.
Set command will never fail.
There is no extra thread except main thread and user required working threads.
There is no built-in cluster solution, but we have designed a VERSION system, you can easily build one yourself.
- A system S to store and distribute server cluster information.
- start all new added server and stop all no longer needed.
- update server status with increased server version.
- notify the clients, may be just establish connections to each server with the new version.
If the connection is broken, client side should always try to get the server status from S first before reconnection.
- received new server information from S.
- close all old connections.
- publish new connections with new server version.
- client ready to continue the commands after all server connected.
- Client should connect to the server using tcp over ipv6.
- See conn.h for command code.
- See errno.h for errno.
[ IN ] [errno] [ 1 ]
[ OUT ] [thread-id] [version] [=ERRNO=] [ 4 ] [ 4 ]
[ OUT ] [command] [key-size] [ key ] [ 1 ] [ 1 ] [key-size]
[[set] == TRUE] [ OUT ] [ OUT ] [set] [value-size] [ value ] [=ERRNO=] [ 1 ] [ 8 ] [ value-size ] Note: [=ERRNO=] is always E_NONE, is required for connection reuse
[[errno] == E_NONE] [[errno] == E_GET_MISS] [ IN ] [ IN ] [=CMD=] [errno] [value-size] [ value ] [ =SET= ] [ 1 ] [ 8 ] [ value-size ]
[=CMD=] [=ERRNO=]