I have read the posts about log warnings and the FAQ at http://knol.google.com/k/marce/app-engine-community-faqs/vkzeph4si12v/1#
----------------- From the FAQ A: The mcycles number included in log entries includes only the CPU consumed in the Python runtime and the datastore. The number in the dashboard includes the mcycles used in both your code and API code. This is why the dashboard number is usually higher. ------------------ if I understand the FAQ can I write a python request handler that does a lot of calculations and won't get a log warning? The calculation has no datastore get() or put() operations and very few python runtime calls like zip(), map(), list comprehentions. I tested extensively the other side: heavy datastore request handlers and noted the average CPU a request costs. The numbers are taken from the dashboard. And about 100 to 400 requests per value of N where used to determine the average. My test Model contained an IntegerProperty and a StringProperty. The number was random [0..10000] and the strings had 10 random lowercase characters. I started with a datastore that contained more then 1000 of these objects. =========== The first experiment was: How much CPU does it cost to fetch N objects? Every request reads N objects starting at a certain random number. query.filter('num >=', startNum).fetch(N) There is a wait of 1 sec in between requests. here are the measurements N=0 CPU=7 Mcycle N=1 CPU=108 N=5 CPU=264 N=10 CPU=464 N=15 CPU=663 N=20 CPU=863 N=25 CPU=1059 N=30 CPU=1260 I have made a graph of these figures: http://tinyurl.com/6hkc6q (a very long google chart URL) I also did the experiment to print the number and string of these N objects with a Django template and with a Python for-loop. The Python for-loop costs 1Mcycle extra for every value of N, the Django template costs 6 Mcycle extra for N=30 and 3 Mcycle extra for N=5. =========== The second experiment was: How much CPU does it cost to create or delete N objects? A request creates N objects starting at a certain random number, n, n+1,n+2.... Puts them in a list and stores them with db.put(objlist) The delete request reads N objects starting at a certain random number. query.filter('num >=', startNum).fetch(N) Then calls db.delete(objlist). There is a wait of 1 sec in between requests. here are the measurements N=1 createCPU=799 deleteCPU=699 Mcycle N=2 createCPU=1589 deleteCPU=1306 N=3 createCPU=2377 deleteCPU=1957 N=4 createCPU=3150 deleteCPU=2585 N=5 createCPU=3956 deleteCPU=3216 N=10 createCPU=7900 deleteCPU=6317 A graph of these figures: http://tinyurl.com/6s3hq7 Only 2 of all these requests, a couple of 1000 in total, did result in a log warning that I use a lot of CPU, one for a create(N=3)[4239Mcycle] and one for a create(N=4)[5046Mcycle] Why not the 100 create requests for N=10, and they where 1 sec apart. ( 1 sec wait after receipt of a result ). The log warnings have a threshold of 1000Mcycle, and if I remember correct I have read, you are allowed 2 per minute before the app is blocked temporarily. During the testing of this experiment I had a dashboard line telling me a series of requests took 11000 MCycle on average, NO log warning. Why don't these (>2000Mcycle) datastore requests give a lot of log warnings? The time spend in my code is around 7 Mcycle (N=0). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---