Am 30.04.2010 um 14:58 schrieb Ben Sizer:

In a post here dated 27 May 2009 Mark Ramm write that "TurboGears has
been threadsafe since day one". Obviously 'threadsafe' is an ambiguous
term and can mean a variety of things but I would guess that in this
context it means that TurboGears executes each request in serial order
so that they cannot interfere with each other except via the database.
Is this a correct assumption? If not, how does TurboGears implement
thread-safety?

No, that is not the way it is meant. TG is thread-safe in the sense that several threads work parallel - within the limitations of the Python-interpreter itself (GIL).

TG has no global state that is altered during a request/response and thus could cause problems when several requests are processed.


The reason I ask is because I have an application where each HTTP
request may result in executing a fairly expensive piece of code,
perhaps taking up to a second to finish, to generate a JSON response.
If the web server can only handle 1 request at once then this could be
a potential bottleneck when there are multiple requests coming in. I
would rather not fudge this with extra background threads and multiple
requests if possible.

This is not a problem (unless of course you create one yourself by using e.g. global locks in the python process or database)

Diez

--
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to