Green threads and Web-application
- From: Vladimir Zolotykh <gsmith@xxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 16:08:06 +0300
Writing Web-application and multiprocessing are closely related
subjects. Each new HTTP request gets processed in a separate thread in
AllegroServe (portable). Here comes the difficulties:
1. One foreign call hangs up all threads (no one of them works until
foreign call is done, actually the whole Lisp world is flat-out
hung for a while).
2. Even if a thread doesn't foreign call but computes something w/o
making any I/O all other threads also have to wait.
Visible outcome of the first mentioned point is that if one of the
users of the Web-application does something that causes issuing
foreign call he and all other users of the same application can't do
nothing until it is done.
Is there a way to overcome these difficulties in the CL implementation
with non :os-threads threading model (CMUCL for example)?
Yes, it is possible to use separate OS processes (instead of Lisp
threads) to handle HTTP requests in AllegroServe, in that case
however, there is no easy way for mutual communication among them no
more, no shared variables for example and the size of the each process
is some 30M, which is rather expensive.
One possible solution of the problem might be switching to another
Lisp with native threading like SBCL (for Linux, not for
FreeBSD). However it seems too much luxurious, especially if you
already have a bunch of applications written for another Lisp like
CMUCL.
The overcoming of #2 may be achieved by inserting MP:PROCESS-YIELD,
or (SLEEP 0), or whatever which 1) implies some knowledge of the code
being changed and 2) unfortunately it has nothing to do with the
difficulty #1
I'd appreciate if you shared some of your thoughts on this
subject. What is the proper and reasonable way to get robust web
application with green threads ?
--
Vladimir Zolotykh
.
- Follow-Ups:
- Re: Green threads and Web-application
- From: Pascal Bourguignon
- Re: Green threads and Web-application
- Prev by Date: Re: Compilation Error: ACL 7.0 Trial Edition
- Next by Date: Re: Relative merits of Lisp-1 vs. Lisp-2?
- Previous by thread: Compilation Error: ACL 7.0 Trial Edition
- Next by thread: Re: Green threads and Web-application
- Index(es):
Relevant Pages
|