From: Geoff T. <gta...@na...> - 2001-03-01 22:20:09
|
Chuck Esterbrook wrote: > At 05:44 PM 3/1/2001 +0100, Tom Schwaller wrote: > >This means that you can't safely use them in servlets without > >marking the Servlets as not thread safe. > > Yes and regarding thread safety, I think it's interesting to note that a > lot of WebObjects applications ship without multithreaded servlets, only > multithreaded I/O. The reason being that most people don't realize how > unthreadsafe their application really is unless they have carefully planned > for it. Also, it's easier to write servlets if you can assume that a particular servlet instance will only be used by one thread at a time, because you are then free to store data temporarily within the servlet instance. I don't think requiring servlets to be marked as non-thread-safe is a problem. That's what Page does by default. > I would be interested in have an app server that would do the same thing. > At the very least, it could be used for testing (e.g., if you have strange > problems, go to single thread mode and see if they clear up). And at the > very most, you could just run it for real. Most of us have one processor > anyway and we all suffer from the Python global interpreter lock even on > SMP machines. I don't think deploying most applications using a single-threaded WebKit would be a good idea. Some servlets will naturally take much longer to do their work than others. For example, a graph-rendering servlet or a servlet that performs a complicated SQL query would take much longer to process a request than more simple servlets. By running a single thread, you're serializing all requests -- which means you can't process the fast, easy requests while the slower request continues to churn along in another thread. Also, the global interpreter lock is released during database queries so other servlets get to run. But not if you're using a single-threaded app server -- in that case the CPU is idle while database queries are going on. > Perhaps this is as simple as setting the max thread count to 1 and using > AsyncThreadedAppServer. Yup, this ought to do the trick, but again, I'd only use this for debugging purposes. -- - Geoff Talvola Parlance Corporation gtalvola@NameConnector.com |