« swifty - a very fast shared memory cache | Main | Swifty 0.03 »

Swifty-0.02 and Perl Binding

This is the announcement of swifty version 0.02 and its perl binding Cache-Swifty 0.02.

To install swifty, run configure, make, and make install. To install Cache-Swifty, run perl Makefile.PL, make, and make install. Changes from the previous version are:

  1. added configure script
  2. expiration handling by modification time and a global lifetime property
  3. introduction of perl binding

As part of the perl binding, I created a benchmark comparing swifty and memcached (the benchmark script is included in the perl binding).

$ perl -Iblib/lib -Iblib/arch -Ilib benchmark/memcached.pl

Write (16 bytes):
                   Rate Cache::Memcached    Cache::Swifty
Cache::Memcached 6.96/s               --             -94%
Cache::Swifty     108/s            1444%               --

Read  (16 bytes):
                   Rate Cache::Memcached    Cache::Swifty
Cache::Memcached 3.87/s               --             -99%
Cache::Swifty     291/s            7420%               --

Write (1024 bytes):
                   Rate Cache::Memcached    Cache::Swifty
Cache::Memcached 6.88/s               --             -93%
Cache::Swifty     101/s            1375%               --

Read  (1024 bytes):
                   Rate Cache::Memcached    Cache::Swifty
Cache::Memcached 3.77/s               --             -99%
Cache::Swifty     281/s            7357%               --
displayed units are 1,000 iterations

It is difficult to draw a single conclusion from this benchmark, since the design goals of the softwares are quite different (see my previous post for the design of swifty). For example, swifty concentrates on speeding up a shared-memory cache on a single server, while memcached is a disributed system. But looking at the numbers, clear advantage seems to exist for swifty in single-server systems. Also it seems to be logical to use swifty as a frontend for memcached.

05:06pm added: Benchmark against Cache::FastMmap. Which cache module is better depend would depend on the cache access pattern and how high the penalty cost of cache misses are.

$ perl -Iblib/lib -Iblib/arch -Ilib benchmark/all.pl

Write (16 bytes):
                  Rate Cache::FastMmap   Cache::Swifty
Cache::FastMmap 8.63/s              --            -92%
Cache::Swifty    108/s           1157%              --

Read  (16 bytes):
                  Rate Cache::FastMmap   Cache::Swifty
Cache::FastMmap 36.5/s              --            -88%
Cache::Swifty    296/s            709%              --

Write (1024 bytes):
                  Rate Cache::FastMmap   Cache::Swifty
Cache::FastMmap 8.57/s              --            -92%
Cache::Swifty    104/s           1113%              --

Read  (1024 bytes):
                  Rate Cache::FastMmap   Cache::Swifty
Cache::FastMmap 35.5/s              --            -87%
Cache::Swifty    282/s            695%              --

Comments

please tell me the memcached version and Cache::Memcached version.

and, do you use Cache::Memcached::GetParserXS?That module make faster to read cache from the memcached.

Thank you for your interest.

I used memcached 1.2.2 provided by MacPorts. And I didn't have a chance to use Cache::Memcached::GetParserXS, since the MacPorts package did not include memcached.h.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)