Note that there are some explanatory texts on larger screens.

plurals
  1. POCode runs extremely slowly inside Google App Engine
    primarykey
    data
    text
    <p>I'm doing some experiments with doing work (in this case, a MD5 brute-forcer) on Google App Engine using the MapReduce framework. </p> <p>I'm having an issue where the code runs extremely slowly inside GAE, even just using the development server</p> <p>This code <a href="https://github.com/jordan-thoms/Hash/blob/f982956f41313cd4fe3b5105aee21ea11bd3af16/src/nz/net/thoms/hash/mapreduce/HashMapper.java" rel="nofollow">https://github.com/jordan-thoms/Hash/blob/f982956f41313cd4fe3b5105aee21ea11bd3af16/src/nz/net/thoms/hash/mapreduce/HashMapper.java</a> will only handle approximately 4,000 hashes per second (this is time inside a single call to map(), and there is no google app engine apis used at all inside it). </p> <p>I took the code outside and ran it standalone - <a href="https://github.com/jordan-thoms/Hash/blob/f982956f41313cd4fe3b5105aee21ea11bd3af16/src/nz/net/thoms/hash/StandaloneTest.java" rel="nofollow">https://github.com/jordan-thoms/Hash/blob/f982956f41313cd4fe3b5105aee21ea11bd3af16/src/nz/net/thoms/hash/StandaloneTest.java</a> , and that version will do over 1 million per second. It's the central loop that's running slower, which is strange since none of that code has anything to do with the google app engine.</p> <p>I've tried running profilers on the Google App engine code, but I haven't found anything useful - seems to be a ton of calls to checkRestricted() and things like that though. I tried removing the security manager </p> <p>Even this simple code:</p> <pre><code> int i; for (i=0; i&lt; 1000000; i++) { i += 2; i += (int) Math.sin(i * (i + (int) System.currentTimeMillis())); } long enda = System.currentTimeMillis(); System.out.println("took " + (enda - starta) + " i:" + i); </code></pre> <p>Runs in 117 ms if I put it in a normal program, and in over 400ms inside a servlet in the developer mode, on the same processor.</p> <p>(Interestingly, the mapper gets about 60,000 hashes done per second on the production Google App Engine. So a lot faster, but still very slow compared to a standalone program)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COI don't really know, but before checking anything else what JIT (and relevant options) does GAE use, and what does your standalone code use? I ask not because I can usefully do anything with the answer, but because if you knew maybe that would help you :-) Also, part (probably not all) of that factor of 15 difference between production GAE and your standalone could just be that your machine is faster than the effective CPU speed they give to each app. As for the development server, raw speed there probably not a priority for Google!
      singulars
    2. COThanks - I used visualvm to look at the process for each, and I couldn't see any custom jit options for the GAE server and they are both using Hotspot 20.6-b01. Is there somewhere else I should look?
      singulars
    3. COI meant the production GAE options -- you'd think they use good optimization, but for all I knew you were using better. I don't know if/where they document what they use, but if you aren't doing anything special then I wouldn't immediately expect them to be multiple times slower. I wouldn't try to puzzle out the development performance, like I said I doubt it's a priority, so if they've crammed the dev server code full of instrumentation there might be nothing you can do about that.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload