Trond Norbye's Weblog

Monday Mar 03, 2008

Get it while it's hot!

Memcached 1.2.5 is being released today, so you should go ahead and download it. We are currently working on integrating this version into Solaris, but it is easy to compile it yourself if you don't want to wait for us ;-)

If you are running OpenSolaris build 79 (or newer), building 1.2.5 should be as easy as:

./configure --enable-threads --enable-64bit CC=cc CFLAGS=-O

I have added support for large memory pages in this version, but it is disabled by default. To enable the use of large memory pages you need to add -L to the command line. When started with -L memcached will also preallocate all memory up front and reduce the numbers of lock to acquire when the slab allocator needs to allocate more memory for a given slab class. By using large memory pages memcached could reduce the number of TLB misses (depending on the access pattern), and hence improve performance. See http://en.wikipedia.org/wiki/Translation_lookaside_buffer for a description of TLB.

Saturday Feb 09, 2008

Improve the performance on your Memcached server

I recently came across this interesting blog about tweaking the TCP stack in Solaris for improved latency, and with a small test I noticed a significant latency improvement. Since low latency is important for memcached servers, you might want to try it yourself?

Friday Jan 25, 2008

Memcached source repository

I am currently working in a team here at Sun that focus on improving Memcached performance.

The official Memcached source repository is a Subversion repository located at http://code.sixapart.com/svn/memcached/. Since Subversion is not well suited for distributed development, we need a place to store our changes while waiting for them to be accepted into the official repository.

I asked the community how we should do it, and they responded that we should set up an a repository to incubate our changes. I have created a Mercurial repository in the Web Stack project. It contains two Mercurial branches:

You may clone the repository with the following command:

$ hg clone ssh://anon@hg.opensolaris.org/hg/webstack/memcached-incubator

To select the branch you would like to see, execute the following command:

$ hg update branch

To see the difference between the two branches, just select the default branch and execute:

$ hg diff -r memcached

Please note that bugs should be reported to "memcached at lists dot danga dot org" unless it only applies to our branch. In that case you can send them to "webstack-discuss at opensolaris dot org"

Tuesday Jan 08, 2008

Memcached in Solaris

I have been working on integrating Memcached into OpenSolaris for a while, and it is now integrated and available if you would like to try it!

The Memcached server is controlled by SMF and needs to be configured before it can be started. You must at least specify the username for the user you would like memcached to run as, and you would probably like to increase the amount of memory the server should use. In the following example I am using the user nobody and 2GB of memory (note: you should not exceed the physical amount of RAM available)

# svccfg
svc:> select memcached
svc:/application/database/memcached> setprop memcached/options=("-u" "nobody" "-m" "2048")
svc:/application/database/memcached> quit
# svcadm refresh memcached
        

You can now start memcached by executing:

# svcadm enable memcached
        

And to monitor the status om memcached, you can just execute:

$ svcs memcached
STATE          STIME    FMRI
online         08:20:03 svc:/application/database/memcached:default
        

To shut down the memcached server, execute:

# svcadm disable memcached     
        

Please see memcached(1m) for more information.