0

Has Java blocking IO on 64 bit Linux, in 2015, solved the C10K issue?

In other words:

Can a thread-per-socket Java server (not NIO), running on 64 bit Linux, keep 10,000 threads running?

Can it trivially reply to incoming data (on a small subset of the connections) within a millisecond or two?

fadedbee
  • 42,671
  • 44
  • 178
  • 308

1 Answers1

1

I don't see any limitations inherent to Java here. Can you start 10,000 Java threads? Yes, easily. Can you open 10,000 java.io sockets? Yes, you can. Can your Linux setup handle it? The only way is to try and find out. Speaking from experience I saw JBoss servers do it on CentOS with >10k java.io connections.

Marko Topolnik
  • 195,646
  • 29
  • 319
  • 436
  • My concerns are: a) an (old?) 30k limit on the number of threads in a JVM and b) does Java blocking IO use epoll, or select, to work out which thread to wake up. (I think select gets very slow when there are tens of thousands of fds.) – fadedbee Sep 02 '15 at 12:19
  • *"I think select gets very slow when there are tens of thousands of fds."* - Is that just a conjecture, or do you have some evidence (e.g. benchmark results) to support this? – Stephen C Sep 02 '15 at 12:44
  • 1
    Although not direct evidence, you may find [this](http://www.thebuzzmedia.com/java-io-faster-than-nio-old-is-new-again/) interesting. It re-examines the myth of slow java.io (which established itself at the time it was valid: around Y2K). – Marko Topolnik Sep 02 '15 at 12:49
  • @StephenC Hearsay and conjecture, but, the fd arrays which you pass to select (and which you need to iterate through) scale linearly with the number of fds. This was the reason for epoll, iirc. – fadedbee Sep 02 '15 at 13:23
  • 1
    But why would blocking IO use selector/epoll at all? There's blocking `read` call. – Marko Topolnik Sep 02 '15 at 13:24
  • @MarkoTopolnik Of course, you're right, I'm being an idiot - I've been working with event-based systems so long that I had forgotten that the JVM's blocking IO isn't built on the OS's async calls. – fadedbee Sep 02 '15 at 13:51