Hi,

I'm running: Linux AS292 2.6.38-13-generic #52-Ubuntu SMP Tue Nov 8
16:53:51 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux Ubuntu 11.04

My CPU is Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz with 2 cores.
Pretty high end laptop.

I've compiled and installed memcached 1.4.10. I've also compiled and
installed libmemcached-1.0.2. I've started memchached without any
additional options.

I'm running a simple c++ program to benchmark memcached sets per
second. I can only get ~22k sets per second which I think is quite
low? I would be expecting at least 50k and even 300k with latest
memcached optimizations?

However maybe I'm completely off with my expectations. Here's the
program that I'm running. Is there anything that I'm doing wrong?

Thanks!

====

#include <cstdlib>
#include <iostream>
#include <time.h>

#include <libmemcached/memcached.h>

int main(int argc, char** argv)
{
    memcached_return rc;
    memcached_st* memc;
    memcached_server_st* servers;

    memc = ::memcached_create(NULL);
    servers = memcached_server_list_append(NULL, "localhost", 11211,
&rc);
    rc = memcached_server_push(memc, servers);

    clock_t start, end;
    start = clock();

    for (int i = 0; i < 1000000; i++) {
        if (i % 100000 == 0) {
            std::cout << i << std::endl;
        }

        memcached_set(memc, "key", 3, "", 0, 0, 0);

        if (rc != 0) {
            std::cout << memcached_strerror(memc, rc) << std::endl;
        }
    }

    end = clock();

    std::cout << "Time required for execution: "
    << (double)(end-start)/CLOCKS_PER_SEC
    << " seconds." << "\n\n";

    return 0;
}

Reply via email to