memcached++ - C++ API to memcached

Antony Dovgal tony2001@phpclub.net
Wed, 9 Jun 2004 14:00:58 +0400


On Wed, 9 Jun 2004 12:50:07 +0300
Sergey Prikhodko <sergey@network-asp.biz> wrote:

> Hi, All,
> 
>   We've written C++ API to memcached, it's very simple and supports
>   only basic operations. You can find it here
>   http://sourceforge.net/projects/memcachedpp/
> 
>   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.

---
WBR,
Antony Dovgal aka tony2001
tony2001@phpclub.net || antony@dovgal.com