bigdata4u / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

Same data has different performance #147

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What version of the product are you using? On what operating system?
spy 2.5 on centerOS 5.3, 64bit machine

Tell me more...
I initialize a memcached client and get the same data twice. And for simplicity 
purpose, I disable multi-get optimization. I find that 1st run's performance is 
much slower than 2nd run's. 

I run attached test class:
java  -cp /sparccache-1.0.jar:/spymemcached-1.4.3rc.jar 
net.spy.memcached.CustMemcachedClientMultiTest 5000 100 y

Here is the result:
//Create a spy client
cost for 100 threads: 726480000(ns)  // first run
//main thread sleeps for 5 seconds
cost for 100 threads: 288456000(ns)  // second run

I assume that client initializes some data structure over 1st run and reuse it 
over 2st run, but have no clue so far. I also checked memcached server. 
Eviction has not happened. So need somebody's help to disclose the magic.

Original issue reported on code.google.com by smilingai2004@gmail.com on 15 Jul 2010 at 3:26

Attachments:

GoogleCodeExporter commented 8 years ago
This is not modeling a real world problem.  I'm pretty sure you're not testing 
what you think you're testing.

Original comment by dsalli...@gmail.com on 15 Jul 2010 at 5:46

GoogleCodeExporter commented 8 years ago
I want to present you one issue happening in a web application. This 
application fetch/store data into memcached by spy client. Similarly, I saw the 
same symptom when all the data is in memcached server.
1) 200 current users logs on the application and do some common business for 
the first time.
2) 200 current users logs on the application and do some common business for 
the second time.

Performance team helped me to compare performance between 1) and 2). They got 
the same result: 1) is much slower than 2). 

I carefully examine memcached stats output and tomcat configuration as follows:
1) Application asymmetrically hits two memcached instances. One instance has 
more get hits than another instance. This is because each login needs to access 
some common objects. 
2) Use executor service to manager thread pool
<Executor name="tomcatThreadPool"
                  namePrefix="catalina-exec-"
                  maxThreads="250" minSpareThreads="25"
            />

Because the application is confidential, I have to write this stupid class for 
your reference. Could you give me some advice in this situation?   

Original comment by smilingai2004@gmail.com on 15 Jul 2010 at 6:46