5 ms·
"Most systems can handle 1K-10K threads efficiently. If you need more connections than that, buy another server, a cheap one cost about $500." Shouldn't the ti
by jshen 15y ago
"Most systems can handle 1K-10K threads efficiently. If you need more connections than that, buy another server, a cheap one cost about $500."
Shouldn't the title be, How to NOT get C like performance in Java ;)
- peter_lawrey 15y agoI would be very interested if you could explain what you mean. ;)
- jshen 15y agoit's mostly a joke, but I think the author is ... making a bad argument. C doesn't require you to buy another server to handle more than 10k concurrent connections. So that contradicts the title, right? But, you can of course handle more than 10k concurrent on the jvm using the NIO stuff.
- pkl 15y agoNo business or web site which has 10K concurrent users will be using just one server. Scalability beyond 10K users/server doesn't buy you anything.
- jshen 15y agosurely you jest
- peter_lawrey 15y agoIn your experience, have you ever seen or heard of a business or web site with more than 10K concurrent users who thought it was a good idea to place all those users on just one server?
- jshen 15y agoconnections and users are not the same thing. Accomplishing a task with fewer resources is better, so when you say " Scalability beyond 10K users/server doesn't buy you anything", you are wrong. Imagine if you have a giant datacenter like google, and heat and power are a serious problem. Accomplishing a task with fewer servers is a serious win.
- jshen 15y agosorry, that quote wasn't from you, but I think the two of you are making the same point, which I disagree with.
- peter_lawrey 15y agoFrom a search I did suggest that Google have nowhere near 10K users per server. That is likely to be because the servers spend most of their time performing searches. The overhead of managing persistent connection is likely to be a small portion of what they do, like most real applications.
- jshen 15y agoYou seem to be implying that since, in this one use case, it's not useful, then it's not useful at all. That's a non sequitur. I already gave one concrete example of where it was useful in my past experiences.
- peter_lawrey 15y agoFair point.
- wladimir 15y agoI also found that particular sentence really strange. "How to get C-like performance in java? Buy more servers!". Yeah, sure, but that approach will work for any language. With async you could handle even more connections with that larger amount of servers...
- pkl 15y agoYou can handle a much larger number of connections provided they don't do anything useful. However if you expect to do anything useful, you are likely to need some horizontal scalability once you have thousands of connections. AdWords charge about $1 per click. Lets say your hardware budget is only $1 per connection. With 10K connections you still have enough money for 10 servers if you wanted.
- jshen 15y ago"You can handle a much larger number of connections provided they don't do anything useful." Define useful? I think you mean, computationally complex, but that isn't the same thing as useful. At my last job I worked on a web crawler, and fetching a page, then persisting it in our grid, was useful work. It was useful to have more than 10k connections in that context. One of my pet peeves is this idea of throwing servers at problems. We currently have enormous problems with power and heat dissipation in data centers. At my last job, where I did the web crawler, we couldn't put any more servers in our data center because we didn't have enough power. Doing more, with fewer servers can be very important. I also wonder how much larger the carbon footprint of computing is because of such philosophies.
- deleted 15y ago[deleted]
- peter_lawrey 15y agoYou make a valid point. There are many organisations which are struggling to manage their data centre costs and the cost of the server is a small piece of the puzzle. They are often unable to upgrade their hardware to minimise costs. Throwing servers at the problem is not a good idea. However, you have to be in a position trade off software vs hardware and many organisation don't make good choices as they are managed separately. Organisation inefficiency often results in having more servers than required. I suspect having more than 10K connections improved how much of your organisations bandwidth you could get. I suspect increasing your available bandwidth would have resulted in less connections required. However if you want to start worrying about the planet, you could ask; does the world really need yet another web crawler. ;) The most effect way to do anything is to avoid doing it at all.