Reputation:
I wonder what are the limits of java.net.ServerSocket and java.net.Socket in request per second. I write some simply test code (multithreaded too) and find limit about 1200 requests per second on my machine (test on double core processor, 64bit linux and 32bit windows).
Is there solution for java to increase ratio per second several thousand? Is JVM overhead to big to for several thousands ratio?
I want to mention that I realize java use native code for this part of code and tests are OS dependent (configuration and implementation).
Upvotes: 0
Views: 603
Reputation: 719709
It is hard to say without looking at your code.
On the one hand, there are things that your application could be doing that would make network I/O (indeed all I/O) slow. For example, reading or writing an unbuffered stream / reader one byte at a time. It is also possible that there is a lot of thread switching going on. Or maybe you should be using NIO to get better throughput.
On the other hand, the slowness might be due to high network latency, low network bandwidth or congestion ... or an OS networking stack that is not particularly good.
Or it could be something else.
Upvotes: 4
Reputation: 533880
Over loop back you should be able to achieve up to 50K requests per second (assuming the request is trivial) I suggest you try this to see what it is for your machine. As @Stephen C suggests, other factors such as what the request does and the network characteristics will make much more difference.
Upvotes: 2