Java builds a socket server to respond to multi-user access

When we build a socket server, we need to respond to multi-user access. At this point, we will use multithreading to establish a thread for each user to respond to the user's access@ H_ 301_ 2@

See the following code for specific implementation: @ h_ 301_ 2@

1. We can write a small test tool class to test the public string getmsg (string MSG) method@ H_ 301_ 2@

Right click this class and select new to create a JUnit test case@ H_ 301_ 2@

2. Use the Apache JMeter tool to conduct pressure test on the server @ h_ 301_ 2@

(1) Open Apache JMeter, right-click test plan - > Add - > threads (users) - > setup thread group @ h_301_2@

@H_ 301_ 2@ @H_ 301_ 2@

(2) Set thread properties (number of threads, cycle times, etc.) @ h_301_2@

@H_ 301_ 2@ @H_ 301_ 2@

(3) Right click to add - > simpler - > HTTP request @ h_301_2@

@H_ 301_ 2@ @H_ 301_ 2@

(4) Set the properties and click Run to conduct the stress test. @ h_301_2@

@H_ 301_ 2@ @H_ 301_ 2@

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips@ H_ 301_ 2@

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>