dreamhead / moco

Easy Setup Stub Server
MIT License
4.36k stars 1.08k forks source link

The latency time will not work well during concurrent requests #209

Open jjggww2002 opened 7 years ago

jjggww2002 commented 7 years ago

I am trying to use moco for performance testing and find an issue. Let's take a look at a simple example. If I use JMeter to send a simple request to moco server ,the response message is received after the specified latency time (1 second) correctly. If I set the cocurrent thread to 10 for JMeter , it will take about 1 to 2 seconds to get the response message. If the count of cocurrent thread is larger , the actual latency will be larger. Does anyone has any idea?

jjggww2002 commented 7 years ago

@dreamhead

davidmeng commented 6 years ago

It seems that the number of thread of mock server is about 10. So some thread response in time. The others response in 2 or 3 seconds

eyinsma commented 6 years ago

Yes, indeed. This is an issue for testing latency performance, since the latency in Moco just is Thread.Sleep(). Can @dreamhead to improve this to use some high performance latency implementation (ie. TimerWheel)?

dreamhead commented 6 years ago

This issue is similar to #230

A simple solution is to add netty property

java -jar -Dio.netty.eventLoopThreads=200 ...
eyinsma commented 6 years ago

I don't think sleep() is a good way. Try to use async way to run the latency task is better.