socket design issues?

C

cmk128

Hi
from
http://www.onjava.com/pub/a/onjava/2002/10/02/javanio.html?page=4

Author said "The JVM thread-management machinery is designed to handle
a few tens of threads, not hundreds or thousands", true?

If i have one jave server that need to serve 1 trillion connection,
in traditional thread per connection design, the java server will hang
because the numberious connection will eat up all the memory by create
too many thread. How can i set a count of max_number_of_connection?
For NIO, i don't think it can do it. Firstly, although you can tell
the selector stop select when the server is very busy, but don't select
doesn't mean no socket income. A million of client try to open a socket
to your server, it will bomb your ServerSocketChannel object. Am i
correct?

so what is the *BEST* solution, any idea?

thanks
from Peter
 
A

AWieminer

http://www.onjava.com/pub/a/onjava/2002/10/02/javanio.html?page=4
Author said "The JVM thread-management machinery is designed to handle
a few tens of threads, not hundreds or thousands", true?
If i have one jave server that need to serve 1 trillion connection,
in traditional thread per connection design, the java server will hang
because the numberious connection will eat up all the memory by create
too many thread. How can i set a count of max_number_of_connection?
For NIO, i don't think it can do it. Firstly, although you can tell
the selector stop select when the server is very busy, but don't select
doesn't mean no socket income. A million of client try to open a socket
to your server, it will bomb your ServerSocketChannel object. Am i
correct?

You just have to skip/drop connections in a selector loop if given
max_num is reached. +1M clients probably require anyway a clustered
environment where external firewall/load balancer can spread physical
connections to a pool of servers.
 
C

cmk128

May i have some more informations about those load-balance routers?
thank you for your time
 
T

Thomas Weidenfeller

May i have some more informations about those load-balance routers?

Google for it.

But may I suggest something else, since you are apparently completely
new to this TCP/IP networking thing:

What about spending some time and reading a bunch of good
introductionary books, and then hiring some professional to do the
software and hardware design for you if you then think it in non-trivial?

Just as an example where you seem to lack basic understanding: An IPv4
TCP interface can handle less then 2^16 TCP connections at a time (the
number of TCP ports is 2^16). Your claim that you have "1 trillion"
connections means that you need more than 15250000 IPv4 interfaces (for
example by using separate servers). Or in other words, your average PC
with just one external IP interface can just handle about 0.0000066% of
these connections.

Apparently, you made that "1 trillion" figure up. But that is one part
of your problems. Instead of making figures up, you should seriously
estimate your traffic (called building a "traffic model"). Because that
one dictates if you really need the heavy gear (server farm, air
condition, load balancers), some medium sized gear or just an
off-the-shelf PC or a cheap (shared) server in some data center.

The socket programming is the least of your problems.

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top