While profiling some datastore performance I discovered a hit where I
hadn't expected one.

It turns out that memcache is taking ~13 ms for each put/get or inc/
dec.

Since I am using a memcache atomic increment as a VM semaphore this
results in a 26ms overhead to acquire and release the "lock".

I'm sure that somewhere I read that memcache takes ~3ms for a request.

Here is the code I used to test:
                MemcacheService mc = 
MemcacheServiceFactory.getMemcacheService();
                mc.put("testSemaphore", new Long(0));
                timer.start();
                for (int i = 0; i < 50; i++) {
                        mc.increment("testSemaphore", 1);
                        mc.increment("testSemaphore", -1);
                }
                out.append("<tr><td>Cache 
increment/decrements</td><td>50</td><td>"
+ timer.elapsed() + "</td></tr>");

                timer.start();
                for (int i = 0; i < 50; i++) {
                        mc.put("testSemaphore", new Long(23));
                        mc.get("testSemaphore");
                }
                out.append("<tr><td>Cache put/gets</td><td>50</td><td>" +
timer.elapsed() + "</td></tr>");

I get ~1380ms for each of the tests, so approx 14ms for each api call.

Any  suggestions?

- Martyn

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to