memcached++ - C++ API to memcached

Antony Dovgal
Wed, 9 Jun 2004 14:00:58 +0400

On Wed, 9 Jun 2004 12:50:07 +0300
Sergey Prikhodko <> wrote:

> Hi, All,
>   We've written C++ API to memcached, it's very simple and supports
>   only basic operations. You can find it here
>   Unfortunately when testing memcached with this API, we found that
>   for our task (caching havy sql requests to database) it almost 5
>   times slower than dumb in-process cache. 

And I can tell you why.

If you change this:
        _sock_write(sock, buf, buf_len);
        _sock_write(sock, (char*)"\r\n", 2);

to that:
        _sock_write(sock, buf, buf_len); // buf already contains \r\n

it will work in at least 2-3 times faster.
I.e. writing to the socket with only ONE call should speed up it a lot.

Antony Dovgal aka tony2001 ||