当对每个查询执行堆和计算密集型过程时,在执行时间在(100ms-900ms)范围内时,在nio vs bio方面的权衡方面有什么经验吗?
解决方法:
真正的问题是,您希望能够扩展到每个物理服务器多少个并发打开的连接(例如,为了支持服务器消息传递推送ala Comet模式-如今谁不想这样做?). NIO将使您实际进入10,000到20,000范围.从操作系统实现的角度来看,线程是非常昂贵的资源(每个线程的内存消耗和上下文切换开销).因此,适度的线程池可以维持数千个NIO连接.
使用MINA之类的NIO框架,滚动NIO一点也不差. (实际上相当简单.)我已经创建了自己的NIO,然后还合并了MINA. MINA是个不错的选择.
http://mina.apache.org/testimonials.html
EURid used MINA during the landrush
for .eu domain names on the 7th of
april 2006. More than 700.000 domain
names were registered during the first
4 hours. After one hour MINA had
handled more than 0.5 million SSL
connections.We found the speed and stability of
MINA to be excellent. And although we
are still using MINA 0.8.1, we found
the API very elegant and easy.