Yes, that sounds correct. If you only have 1 process, the ThreadedDict makes certain dictionaries threadsafe -- specifically web.ctx and any session objects.
Mutliprocess might expose some race conditions within "class Store" in session.py -- combine multiprocess and sessions carefully! -Justin On Jul 27, 3:47 pm, "[email protected]" <[email protected]> wrote: > On Jul 27, 3:33 pm, Justin Davis <[email protected]> wrote: > > > > > > > If you increase the max-procs, you will spawn (at most) that many > > python processes. Note that these aren't threads, but separate > > processes, so you need to be sure that any state within a given > > application isn't necessary. For instance, if you maintain a global > > dict of logged in users, this will break in the multiprocess > > deployment. > > > webpy applications are multithreaded however, so multiple connections > > will be processed simultaneously. However, due to the way python > > implements threading (specifically, the GIL), it's uncommon for python > > threads to really take advantage of multicore architectures. If you > > have several cores and have written the program correctly, upping the > > max-procs variable will help you get more throughput. > > > Good luck, > > Justin > > Thanks Justin! > > Having read your reply and digging deeper it seems the Session object > is a ThreadedDict and HttpServer uses ThreadingMixIn > > I am assuming (hoping) what this means is that each web request is > handled on a new python thread and that the incoming request will have > the session data of its matching session associated with the new > thread. > > Also that any variables defined globally (outside of the session) can > be shared by all threads. Like in your example: a global dictionary > of logged in users. (assuming max-procs is 1). > > I am reading this correctly ... or is the behavior different than I am > describing? > > Thanks and Regards, > Ivan Novick -- You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en.
