Hi all,

I'd like to introduce perfcached, an in-memory cache daemon I've been building 
for VoIP workloads, and ask for your feedback.  I've been running it behind 
OpenSIPS in production since October, and I've just opened a pull request for 
cachedb_perfd, a CacheDB backend for it:
https://github.com/OpenSIPS/opensips/pull/4488

What it is:

- One daemon that keeps data in memory and serves it to OpenSIPS, Asterisk, PHP 
or any Redis client.
- It speaks the Redis protocol too, so cachedb_redis and other Redis clients 
work against it unchanged.
- It is built for VoIP-style state, so a value is capped at just under 256 KB.  
It is not meant for caching web pages or large files.

Why you might want it:

- More throughput per box: every core serves requests, where Redis runs one 
event loop.  On bare metal against a 30-master Redis Cluster, perfcached served 
22.0M SET/s and 24.6M GET/s against Redis's 15.4M and 17.5M, using 31-39% less 
CPU per operation.
- Standalone or clustered: run one node, or several that form a cluster on 
their own.  A cluster has five data placement modes, so you choose between 
redundancy and memory: eager keeps every key on every node and store keeps a 
copy on each node that reads it; spread keeps K copies (you pick K) and 
survives K-1 failures; shard and proxy keep one copy per key, so the cluster's 
memory adds up.  In eager mode losing a node loses no data, and a node that 
crashes rejoins by itself.
- Data that survives a restart: a write-ahead log and snapshots, with a storage 
probe that recommends an fsync policy for your disks.  Both are optional, for a 
pure cache.
- One cache for the whole platform: any number of OpenSIPS instances share it, 
and cachedb_perfd sends each key straight to the node that holds it.
- Multiple collections in one daemon: keep different kinds of data apart, each 
sized on its own, and create, resize or drop them while it runs.  Each can 
front its own Redis, and Redis clients reach them by database number.
- Pub/sub across the cluster: SUBSCRIBE, PSUBSCRIBE and PUBLISH, as in Redis, 
with a message published on any node delivered to subscribers on every node (at 
most once).
- Moving off Redis gradually: put perfcached in front of the Redis you run now 
and take its keyspace over, with no big-bang copy.
- Easy to operate: a dashboard, Prometheus metrics with a Grafana dashboard, 
and mail alerts.

With OpenSIPS: cachedb_perfd (in modules-contrib; needs libperfd 0.7.6, shipped 
with perfcached 0.7.5):

  modparam("cachedb_perfd", "cachedb_url",
      "perfd://:[email protected]:6479,10.0.0.6:6479,10.0.0.7:6479/sessions")
  cache_store("perfd", "sess_$ci", "$fu", 300);

It works like cachedb_redis, though without its full set of functions.  It has 
cache_store/fetch/remove with a TTL, atomic counters 
(cache_add/sub/counter_fetch), and cache_raw_query() with MGET (up to 256 keys 
in one round trip), EXISTS, EXPIRE and JSON.SET/GET/DEL, plus perfd_fetch() for 
async() statements.  It lacks the query, update and map functions, so modules 
that need them, such as usrloc, can't use it.

  Project:     https://github.com/Lt-Flash/perfcached
  Release:     https://github.com/Lt-Flash/perfcached/releases/tag/v0.7.5
  Quick start and known limits:  
https://github.com/Lt-Flash/perfcached/blob/master/README.md
  Benchmarks:  
https://github.com/Lt-Flash/perfcached/blob/v0.7.5/bench/RESULTS.md

It's young software and Linux only, and I'd really like to hear how it behaves 
on your setup.  Bug reports, questions and criticism are all welcome - here, on 
the PR, or as a GitHub issue.

Thanks,
Yury

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to