摘要
针对模拟法庭服务器存在大量并发客户请求问题,引入了完成端口(IOCP)多线程控制模型,建立了以主线程、监听线程、服务线程为核心的服务器架构。通过分析数据包的错序原因,提出了具体的解决方案。利用池技术思想,设计了线程池和数据库连接池,较好地解决了多线程竞争资源问题,有效避免CPU在线程调度和切换上的大量开销,充分利用了系统资源。经系统测试结果表明,该服务器能够支持海量并发连接,并具有较强的可扩展性和稳定性。
Aimed at the problem of a large number of clients' concurrent requests in moot court, IOCP multi-threads controlling model is introduced, and the server framework which is made of main thread, watcher thread and service thread is constructed. By analyzing the reason of out-of-sequence data package, an appropriate solution is presented. Thread pool and database connection pool based on pool technology are designed, which solves the problem of multi-threads competition, effectively lowers consumption of CPU in switching and regulating the work thread, completely uses system resources. Experimental results show that the server can support massive con- current connections, and has high scalability and performance.
出处
《计算机工程与设计》
CSCD
北大核心
2010年第21期4736-4738,F0003,共4页
Computer Engineering and Design