Re: [xSocket-develop] production level socket server pitfalls
Status: Inactive
Brought to you by:
grro
|
From: Gregor R. <gre...@gm...> - 2010-02-21 10:10:09
|
Hi Kevin,
the number of (worker) threads is independent of the number of connection. Thats it what you get by NIO. This enables high scalability.
The number of threads depends on you business logic. The call back methods will be performed by the worker threads. If a worker thread is still pending in a callback method, a new worker thread will be created if another call back method (related to another connection) is called. Often the worker threads return s very fast for the call back method (However, this depends on your implementation). In this case you will observe, that only a few worker threads are running.
Gregor
----- Original Message -----
From: Kevin Boyd
Sent: 02/21/10 09:01 AM
To: Gregor Roth
Subject: Re: [xSocket-develop] production level socket server pitfalls
Hello Gregor,
Actually I'm not thoroughly conversant with NIO architecture what do these internal dispatchers do?
You say that each open connection allocates system resources and memory and also do each running thread.
How does xSocket deal with clients, is each client handled in his own thread that means if 100 clients are connected will 100 threads be generated.
Also what are open connections, is 100 clients = 100 open connections.
The OS is Centos 5.2 based on this can I calculate the amount of memory that will be used up if 100 clients have active connections made to xSocket.
Regards,
Kevin
On 2/20/2010 1:18 PM, Gregor Roth wrote:
Hi Kevin,
I would suggest setting the timeouts. By default the timeouts are very high.
Regarding to the memory, by xSocket uses 2 internal dispatchers by default. By default each dispatcher will preallocate 65536 bytes non direct memory (see system propery org.xsocket.connection.client.readbuffer.preallocation.size). This preallocated buffer will be used to read the network data. Each open connection allocates (OS) system resources and memory. This depends on the OS. Further more each running thread also allocates a predefined amount of memory. This also depends on the OS.
Gregor
----- Original Message -----
From: Kevin Boyd
Sent: 02/19/10 09:47 AM
To: xso...@li...
Subject: [xSocket-develop] production level socket server pitfalls
Hello,
For a production level socket server what are the potential pitfalls that I have to consider :
I have started the server as per the tutorial on the homepage using
IServer srv = new Server(8090, new TestHandler());
srv.run();
The TestHandler class implements the following interfacesIDataHandler, IConnectHandler, IDisconnectHandler, IIdleTimeoutHandler, IConnectionTimeoutHandler.
*
I haven'tset any "System Properties" as yet and "FlushMode.ASYNC" is not set. *
Connection and Idle timeout'sare set to default.
I have uploaded this to my VPS host. However before letting it loose in production I wanted to test it for reliability and scalabity. Any suggestions here would be welcome.
Memory is another aspect , My VPS host has allotted me 1GB ram with around 8GB burst capability, is this sufficient. (As of now I have only 500MB free)
My clientswould be continuously connected to the server 24x7, how much resource would each client connection take up in terms of ram, if 1000 or more clients would be connected how do I compute the amount of ram that would be necessary to safely run the socket server.
Please suggest other points that I have missed out here.
Regards,
Kevin
|