Connection Per Thread模式
Connection Per Thread模式,一个线程处理一个连接模式,早期版本的Tomcat服务器,利用这种原理实现;
对于每一个新的网络连接都会分配给一个线程,每隔线程都独立处理自己负责的输入和输出。
缺点:对应于大量的连接,需要耗费大量的线程资源,对线程资源要求太高。而且线程的反复创建、销毁、线程的切换也需要代价。因此,在高并发的应用场景下,多线程OIO的缺陷时致命的。
如果解决:一个有效的路径是使用Reactor反应器模式,用反应器模式对线程的数量进行控制,做到一个线程处理大量的连接。(selectionKey)