Hi,
It's really not my intention to start a threads vs events flamewar here
but I feel obliged to comment ...
Michael Bayer wrote:
On May 19, 2006, at 3:00 PM, Rick Morrison wrote:
But I've read story after story about the evils of thread-based systems
failing in strange ways under load.
probably because they dont synchronize shared resources properly....it
took a very long time for me to get Myghty to be able to reload,
recompile and memory-manage components in midstream, as well as read and
update the various cache backends, without cracking up under load
tests. "ab -c 50" is your friend.
Thread-based systems are by no means impossible but they're a lot more
difficult to get right, as Michael's comments confirm.
I wouldn't be at all surprised if there are still some lurking problems
in Myghty.
Concurrency can be hard even with event based systems; threads generally
make it harder.
I think I understand that
best-practices for for threaded Paste apps is to leave the global
namespace alone, and start and complete a single request in a single
thread -- "finish what you start". Is that really sufficient for
creating reliable multi-threaded apps under load?
single request per single thread...this is how every threaded web
application server ive ever seen *except* for twisted does it.
That's because Twisted is not threaded ;-).
Twisted supports threads but avoids using them when possible. Twisted
definitely does not use threads to process HTTP requests.
However, that doesnt mean the thread dies after the request (Python's
built-in ThreadingMixIn for use with BaseHTTPServer does do it that way,
but also doesnt scale). usually there is a fixed set of "worker"
threads started up which handle request after request. if load gets
high, then the pool of threads grows temporarily.
this is why I tend to like using something like mod_python with Apache;
you get the benefits of your Python program being managed by Apache's
very mature and widely used process model (although on unix its usually
a forking model and not a threading one).
although i hear Lighthttpd is the bomb too, and i just checked
http://www.bittorrent.com/ which serves millions of hits a day using
Myghty and its actually using lighthttpd, which uses a threaded model.
Erm, lighthttpd is most certainly not threaded. It uses a
select/poll/whatever event loop (like Twisted).
I don't know how the bittorrent.com guys connect lighttpd to the Myghty
bit but I guess they use SCGI or FastCGI.
- Matt
--
__
/ \__ Matt Goodall, Pollenation Internet Ltd
\__/ \ w: http://www.pollenation.net
__/ \__/ e: [EMAIL PROTECTED]
/ \__/ \ t: +44 (0)113 2252500
\__/ \__/
/ \ Any views expressed are my own and do not necessarily
\__/ reflect the views of my employer.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users