views:

31

answers:

2

What is the most expensive for a server
(using Java NIO Selector and SocketChannel, but I guess the language and library don't matter anyway)

  • keeping many client connections opened
  • many client connections/deconnections
  • receiving many messages from clients and answering many messages to clients
+1  A: 

I think the second one will be the most expensive, if you use a good object pooling mechanism for the first one. If not, then keeping hundreds of connections open, is going to become a serious issue.

Sending and receiving messages shouldn't be that of a hassle.

Kurt Du Bois
pooling socket connections ? does that make any sense ?
Matthew
+1  A: 

When solving performance issues, never trust any guesses or even "common sense". Always measure. Always profile. In case of doubt write sample applications that do only one of the points in question (its usually quite easy to do). Again and again you will be surprised.

RED SOFT ADAIR