socket design issues?

Discussion in 'Java' started by cmk128@hotmail.com, Aug 3, 2005.

  1. Guest

    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
    , Aug 3, 2005
    #1
    1. Advertising

  2. AWieminer Guest

    > 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.
    AWieminer, Aug 3, 2005
    #2
    1. Advertising

  3. Guest

    May i have some more informations about those load-balance routers?
    thank you for your time
    , Aug 4, 2005
    #3
  4. wrote:
    > 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

    --
    The comp.lang.java.gui FAQ:
    ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
    http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
    Thomas Weidenfeller, Aug 4, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laszlo Nagy
    Replies:
    1
    Views:
    4,744
    Mark Wooding
    Jan 27, 2009
  2. Jean-Paul Calderone
    Replies:
    0
    Views:
    938
    Jean-Paul Calderone
    Jan 27, 2009
  3. Laszlo Nagy
    Replies:
    0
    Views:
    518
    Laszlo Nagy
    Feb 1, 2009
  4. Steve Holden
    Replies:
    0
    Views:
    638
    Steve Holden
    Feb 1, 2009
  5. Steve Holden
    Replies:
    1
    Views:
    691
Loading...

Share This Page