Say, I have two web apps:
The first one just waits for 10 seconds and exits (like, time.sleep(10)).
The second one is checking the time in the loop, working extensively and when it sees that 10 second have passed it quits.
Will both my apps be billed for the same amount of CPU time or the second will be much more expensive?
In other words – does “CPU time” in GAE means the actual amount of work of the instance during request or it represents the total time of instance being in memory from launch to exit?
Note that App Engine is moving away from CPU-hour billing towards instance-hour billing. 10 seconds of sleep and 10 seconds of activity incur the same cost in instance hours.
If your second app is “working extensively”, you’re probably using APIs and consuming additional forms of quota, making the second request more expensive.
If you’re using the 2.7 runtime, you can take advantage of threading. time.sleep releases the GIL, so your instance can serve other threads while your first thread is sleeping.