[xSocket-develop] xSocket for multi-threaded pooled chat application scalability questions
Status: Inactive
Brought to you by:
grro
|
From: Cameron M. <fo...@re...> - 2009-04-10 22:16:12
|
Good evening all,
I am using the newest xSocket 2.4.6 and attempting to create a chat server
that can handle many clients simultaneously. This will be running on a
dedicated linux server with an AMD 1300 cpu and 512mb of ram. I have
created a test server and client from hacking together various tutorials. I
seem to be having some possible performance problems and would like to get
anyones input on my code and where I have not gone the most optimized route.
Server:
Main.java
In mail the only thing to note is I use
"srv.setWorkerpool(Executors.newFixedThreadPool(10));"
to try to limit the thread pool to 10 open threads instead of the default
40. What do you recommend? I tried using the default in my tests (see
below) and with only 40 simultaneous connections I start to get failures and
dropped connections.
xSocketDataHandler.java, Implements onData, onConnect, and onDisconnect.
A collection is used to keep a running list of the connections by adding
and deleting them in the onConnect and onDisconnect method. I saw a post
about using getOpenConnections, but I do not see a way to do this from the
xSocketDataHandler class. Is there a better way to maintain the list of
connections in order to send messages to them all?
Client: xChatClient.java, xSender.java, xClientHandler
Running the client will create an array of 40 connections. Those 40
connections will be passed to 40 threads which will each send a message to
the server, every few seconds, 100k times.
I started up my server on my dedicated server. Then on my development pc
(AMD 4200, 2gig ram) I started up 4 clients. After 10 minutes I checked on
the app and there was 120 connections. I checked top and the app was taking
up 213 virtual memory, 35 megs of ram, and 10megs of shared memory. After
20 minutes I checked and the connections were down to 47, the rest had
bombed out for some reason at some point. The app was now taking up 25 megs
of memory.
Is it better to test the clients on a separate machine going out over cable
modem to the server (the above test), or would it be better to run the
clients on the same machine as the server?
This is a link to my source code, I have kept it real simple for this test:
http://www.quickfilepost.com/download.do?get=acfb22c50e233175e293d41a04b00aa9
Thanks!
|