the write strategy of the client implement affects the set performance dramatically?

Todd Lipcon todd at
Tue Mar 4 17:18:44 UTC 2008

Hi Yin,

Are you using SO_NODELAY on your client socket?

That's one thing to try. The other option is to use a buffered socket and 
only flush once you've buffered the entire request.


On Wed, 5 Mar 2008, Yin Chen wrote:

> Hi:
>    I am involved in the optimization of the performance of a  memcached
> client library now(written by c).
>    And I found that if I want to set a big value(say: 9000 bytes long),
> prepare all the data and call write once or split the data to two writes
> will cause dramatic performance difference: the latter is about 100 times
> slow than the former.
>    I do the experiment on my own machine, a single core T43 notebook. Run
> one memcached server instance with the command "/usr/bin/memcached -m 64 -p
> 11211 -u root", and write code to connect to the 11211 port to write the set
> operation data. Iterate 100 times to set a 9000 bytes value each time. The
> client.c code prepares all the data and write the data once. The
> client_multi_write.c code splite the data to two writes. Run the two
> programs to get the above result.
>   I think it's partly related to the implement of the memcached? Anybody to
> confirm the above experiment or give me an explanation?
>   Thanks.
> -- 
> Chen Yin
> School of EE & CS, Peking University

More information about the memcached mailing list