-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MockServer/MockHandler performance #2558
Comments
@sturose thanks for the report and I will keep it open. it is quite likely we can use code from #2530 to replicate besides JS eval, there is a global lock for every request which in future we need to make user-opt-out via a tag:
I'm pretty sure the work we are doing to replace the JS engine will help in case it is the JS eval which is the bottleneck. refer: #2546 finally for completeness - there is this "alternate" way to implement mocks, but my guess is you may want to stick to the simpler way: https://github.com/karatelabs/karate/wiki/Karate-JavaScript-Mocks |
I was facing similar performance problems in MockServer, especially when dealing with a large number of scenarios. It sounds like the JS evaluation (JS.eval) is indeed adding significant overhead, which can lead to inconsistent response times. In my fork of the repository, I implemented a few optimizations that might help address these issues:
In your situation, where you're testing an application with numerous scenarios, applying this kind of context-path filtering could prevent MockServer from having to evaluate each scenario. Feel free to explore these improvements if they might be useful in your setup. |
I am currently attempting to do some performance testing using gatling against an application, and some of the mock servers have a lot of different Scenarios to match against (more than 50, less than 100).
I'm finding that that MockHandler.isMatchingScenario is using more processing than the actual application logic I'm trying to performance test. Sometimes the responses coming back from MockServer will take over 1000 ms when there is no delay configured.
As best as I can tell the vast majority of slowness is coming from JS.eval, which leads me to believe that I should perhaps look to use a different MockServer solution, but I thought I'd see if this is an expected outcome for the way MockServer is designed?
I did attempt to put the more likely to match scenarios at the top, which improved the situation dramatically, but it did not solve the problem of inconsistent response times. At that point performance was still hindered by things like initEngine which seems to occur for every incoming request into the mock server.
I realize this probably isn't a bug report you can use at this time, but I thought it might be worth letting you know.
The text was updated successfully, but these errors were encountered: