This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I am running a simple socket programming to transmitmessages which is about 500Bytes. Am only able to acieve close to 1000-1200 messages per second despite trying multi threaded clients and running both server and client on the same machine. Can any one please advice me on what I can do to achieve faster rates. My target is 10000 messages per second
below is the basic server program of mine (changing buffer size didnt really help)
Karthik Ananthasubramanian wrote:running both server and client on the same machine.
That's one problem. If you are just interested in the number of connections the server can handle, why are you running the client on the same machine?
How fast is your hardware? Do you have multiple CPU's like a server-class machine should? Have you benchmarked your machine to check for RAM or CPU bottlenecks? Are you running other applications that are stealing valuable CPU cycles from your application?
You do an awful lot of work in the main method before you finally spawn some worker threads. Save that work for the workers. A thread pool may be a good idea too. You know you are going to be receiving connections and need threads to process them. Why wait until there's a client on the line before creating it?