| In the context of the great development of communication technology,the popularity of the network is getting higher and higher,and the application scope and scale of the network are getting bigger and bigger.In the consumer-oriented field,with the vigorous development of the Internet,network users have proliferated,and the length of time and number of requests initiated by network users have also increased dramatically.In many application scenarios such as online education,online shopping,streaming live streaming,instant messaging and other systems,the huge user scale has brought super high concurrency.Response time is an important indicator that affects user experience.In order to be able to respond to requests quickly,network applications need to have high concurrent processing capabilities.The Java program runs on the JVM and has platform-independent characteristics.Its complete standard library and huge ecological environment make the Java language very widely used in the field of server development.However,servers developed using traditional Java network technology cannot support the increasing concurrent volume.Once high concurrent traffic is encountered,the traditional server will experience a sudden drop in performance or even a crash,seriously affecting the normal operation of the network system.Therefore,it is very necessary to study high-performance Java network technology that can deal with high concurrent network traffic.The traditional IO flow in Java is unidirectional,byte-oriented,and blocking IO.This thesis analyzes the network application model based on IO flow and explores the reason why it cannot support high concurrent traffic.Subsequently,this thesis introduces NIO technology.NIO is a bidirectional,buffer-oriented,non-blocking IO method.Based on the analysis of the network model built with NIO technology,the new multi-reactor server model performs a performance comparison test between the traditional IO mode and NIO different models,and analyzes the main causes of performance differences between the multiple modes to select the programming model that is most suitable for high-concurrency application scenarios.The experimental results show that the average response time of the new server model when handling 10,000 concurrencies is 2.09 milliseconds,and the CPU occupancy rate is 68.5%.Compared with the traditional IO server model,the multi-Reactor server model based on NIO can not only handle up to 10,000 concurrent traffic,but also the server load is lower than other NIO server models.However,the performance of a single server is limited.In order to further improve the processing capacity of the entire network system,usually multiple servers are required to work together.This thesis studies a dynamic load balancing algorithm to distribute the pressure of the entire system to multiple servers reasonably to improve the system’s concurrency capability.Finally,this thesis designs and implements an instant communication system and tests it,verifying that the new system model can provide higher concurrent performance. |