Alex Rivera | Logout

Why does Google App Engine support a single thread of execution only?

Asked 2010-09-27T00:28:57.180
16

Does anybody have an idea why Google App Engine permits only a single thread of execution for a deployed application?

I personally believe that it has something to do with the predictability of an application so that Google can size its performance more reliably. There does not appear to be any rationale posted on Google's site regarding single threaded execution hence my question.

Having an application that is already multi-threaded and presently deployed on a VM means that it is difficult for me to move to the cloud given this restriction.

EDIT: I've marked the answer below as it sounds quite plausible that threads are not permitted due to horizontal scaling requirements. Naturally threads all execute within the same process space and, as GAE can run many processes for your application, it would be difficult to share threads. That said, I still think that a small thread pool per process would be useful and might help migrate apps to the cloud. I shall request this as a feature. Thanks for the discussion!

Edit
Report

1 Answer

2

I don't know for sure, but I believe it is probably for security reasons. If they allow multiple threads, they are opening themselves up for a fork() bomb (or threading equivalent). Also, it greatly simplifies resource management - Google only needs to manage a single thread worth of resources per application.

answered 2010-09-27T00:46:13.390

Your Answer