开发者

What is the most "expensive" for a server: connections opened, send/receive messages or connections/deconnections?

What is the most expensive for a server

(using Java NIO Selec开发者_如何学编程tor 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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜