On Thursday 06 December 2001 16:15, Daniel Popowich wrote: > Tavis Rudd writes: > > On Thursday 06 December 2001 10:35, Daniel Popowich wrote: > > > What happens then on a heavily loaded system when 100s or more > > > are hitting the same Servlet? Could this not lead to disaster > > > if in my code I always refer to self.request() to get the > > > request object? Couldn't one request overwrite another? > > > > canBeReused() is only part of the story. There's another method > > called canBeThreaded() that returns False by default. Unless > > this is set to True, each thread will use a separate instance of > > the servlet. If you have 10 threads you will have a pool of 10 > > servlet instances. Thus, there is no problem with concurrency. > > And may I assume that if I have more requests than threads, they > excessive requests will block?
All incoming requests are placed in a queue that's serviced by the threads in webkit's pool. If there no threads are available they wait in the queue until one is. The size of the queue is configurable, as are the number of threads, and the number of incoming connections on the main socket waiting to be put in the request queue. > > > 3. Use instance attributes for data meaningful across all > > > sessions and requests. > > > > No, use something else for this. You should use a database, a > > ZODB store, or something else with the appropriate > > synchronization mechanisms to avoid conflicts between threads. > > Store a reference to your shared object in a python module that > > can be imported from anywhere, or as an attibute of the > > Application. > > I'm thinking about data like that found in the Colors example that > comes with WebWare. It's painful to compute everytime and since > the data will not change across all users/sessions/requests, > caching it in the instance is fine. Ok, I see what you mean. That definitely makes sense if your data isn't going to change. Cheetah's partial output caching uses the same technique. Tavis _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
