Re: Millions of Threads ?
- From: "Chris Uppal" <chris.uppal@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 26 Aug 2006 10:40:36 +0100
frankgerlach@xxxxxxxxx wrote:
I am thinking about a telecom application, which would potentially
handle millions of mobile
phones (J2ME) as clients. Of course, I need a server (J2SE), too.
The "easy" implementation uses TCP connections for the client/server
communication. Problem is that there are only 65000 sockets per IP
address of the server. I think I could solve that by configuring
multiple IP addresses per network card.
Assuming < 10e6 customers, and average of 10 messages per day, and a target
turn-around time of 0.5 seconds, that suggests that you would have an average
of around 600 interactions "in-flight" at any one instant. Obviously you would
have to model/estimate how much the peak load would exceed that. That suggests
that running out of port numbers is not going to be one of your problems.
Still, two problems remain: Memory used by each TCP connection and by
the enormous number of threads (each client would have a server thread
for the "easy" implementation)
On most OSs each thread consumes a lot of resource -- the stack space for
instance. It also puts load on the scheduler. Don't use that many threads
unless either your JVM is specifically designed to handle that many threads as
lightweight entities (Sun's are not), or your OS is specifically designed to
provide ultra light-weight threads (I believe that there is a Linux threads
implementation which claims to have this property -- I have no experience of it
at all myself).
Otherwise, that many concurrent requests puts you squarely into NIO territory.
Then scale up your CPUs and/or load-balanced server boxes to make the target
turn-around time achievable. Same goes for the database (if any).
Notice that, on the above assumptions, you will be serving a request at
intervals of (on average) about 1 millisecond. That is substantially less than
the typical disk-seek time. If each request causes one disk read, and if there
is not enough temporal correlation between requests (which there might be),
then each request will also cause one physical disk seek -- so you need
sufficient spindles to allow that many seeks to be issued without blocking each
other.
-- chris
.
- References:
- Millions of Threads ?
- From: frankgerlach@xxxxxxxxx
- Millions of Threads ?
- Prev by Date: Re: 0xE8 converted to int returns me -24 instead of 232
- Next by Date: Re: Mixing text and binary I/O
- Previous by thread: Re: Millions of Threads ?
- Next by thread: Re: Millions of Threads ?
- Index(es):
Relevant Pages
|
Loading