> handle each batch of requests
> from client side
> right? why not use a thread pool for that?
Apache already contains a thread/process pool.
Depending on your apache configuration there will be
no more than 2*n processes/threads running at a time;
1 process or thread from the apache pool connected
with 1 corresponding thread spawned by the JVM.
If we want to avoid to spawn a new thread each time
we accept, creating an "open" thread pool would make
sense, however. But I am not sure it's worth it.
Creating a NPTL thread or calling clone() isn't as
expensive as one might think. -- The main purpose of
a thread pool is to limit the resource usage, which is
something apache already does for us.
> have you tried a "pure java" server? would the
> performance be too bad?
Yes, but:
a) Java currently does not support local sockets, so
you must create a TCP/IP socket. Doing this on the
web-server is not be a good idea. So you will want to
start the server part on a different machine and open
your firewall to accept connections on that port from
the web-server:
b) Non-local TCP/IP connections must check the byte
order etc. so you cannot simply swrite/sread JNI types
anymore. Which means that you must define a
"standard" protocol first. Let's assume we solve this
problem using soap or another protocol, the next
problem will be:
c) With TCP/IP sockets you have to pay attention to
round-trips (latency problem). For example you cannot
send the client a "here's the result as an array
object" and then rely on the client to ask the server
for additional information ("now send me array entry
#12"). You must send all information is a single
call, otherwise you will need N round trips. Assuming
that one trip consts 50ms filling a PHP hashtable with
5000 entries would take 500s.
So we decided to use local sockets, nearly the same
way as jserv/tomcat's ajp adapter does it.
Jost
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 100MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
|