I'm doing load test with Jmeter on web application. Recently I noticed that some of the service responses from the application server started taking longer time to arrive to the client (browser). While inspecting the application code I saw that those particular functions, responsible for the service request/response, do all the mathematical calculations inside the code itself, rather then querying database and do all the calculations there. My question is: will the application behave faster if data calculation is done in the database itself, or it will be faster to do all the calculation in the code (retrieving data separately from db), so I can advise to the developers about possible causes of the slowness. Thanks.
2 Answers
In most of the time, Reading and Writing from an external resource plus network latency has a negative effect on performance and people love to prevent it, if possible. That is why the most common ways to increase the performance are:
- To cache data (so you don't need to read the data from external resources like Database).
- Process in memory, as much as possible (your case).
So I think the performance of your application should have been increased, unless the implementation is not good (e.g alot of thread blocking or poor-performance algorithm etc).
As a general principle,
- if the calculations are set-based calculations, then they will definitely be faster one in the database.
- if they calculations are pure mathematical then there should be no problem in them being done by the test suite, if the language is a compiled language.
It would be interesting to try and force the same calculation (if possible) in the database versus in your application.
-
1I think the OP means the calculations are being done in the code for the application under test, not in JMeter. He was doing tests in JMeter, saw a slowdown, and looked at the application code in response.– c32hedgeCommented May 22, 2017 at 17:45
-