Five checks for a well performing application

To get started you will need a Performance test client like JMeter and setup some test cases for your app. I'd recommend you start by running the app on your local machine, because once it works OK there you can check it in a more production-like setup.

So assuming that you know how to run your tests lets move to our first check.

CHECK 1: Is it fast?

First we will run our test cases with single thread only. This is also a good test to see that our test cases are working at all! While the test is running we will monitor the Average response time reported by the test client.

If the measured value doesn't meet our expectations we will try to fix the problem and rerun the test again.

Remember that to make the fixing part easier you should keep your test cases as simple as possible!

CHECK 2: Does it scale?

Next we are going to increase the number of threads in our test to verify that our app is the true multithreaded beast its supposed to be! In order to do this we will start our test and slowly increase the number of threads while watching the Throughput of our app.

Once adding more threads doesn't increase the throughput anymore we have reached our Maximum throughput.

Next we will check the CPU usage of our setup with a monitoring tool like top. If the CPU usage is not at 100% we will need to find the bottleneck and fix it. And then rerun the test.

We are making the naïve assumption that our app is CPU intensive because it probably should be.

Once the CPU is screaming we will check that the throughput meets our expectations factoring in the difference between our local setup and the production setup, fixing the issue if it doesn't.

Check 3: Does it behave?

Now we are going to keep the load to our application at the max and check that A) responses are still fast enough and B) there aren't any big jumps in them.

So keep the test running at the maximum throughput and check the reported Average response time and Maximum response time. If they are not OK, find the problem and fix it and then rerun the test.

Fixing any issues with the Maximum response time is going to be really difficult unless you have some system monitoring in place. A really good tool for that is Jamon.

Check 4: Does it stay overnight?

Now we are going to let our test run overnight to see if our app stays up overnight. Since you can do this only so often it is recommended that for this step your test cases should cover as much of your apps usage as possible.

I would recommend that you run your test at the maximum since it will help you to see the underlying problems faster. What we are expecting here is that our app will maintain it's performance steadily through the whole night.

We are mostly concerned about memory leaks here so if you're logs are full of OOM in the morning you need to check your applications memory usage with a tool like jhat.

Don't forget to check your log files for both possible errors and size. You wouldn't believe how many times my test runs have failed because the log file gets too big!

And once your app stays up overnight it's time to extend the invitation and see does it stay over the weekend.

Check 5: Does it recover?

As a last step we will check that our application recovers from a basic failure.

So we will run out test just as we did in our previous check at the max with mixed test cases. While the test is running we will restart our app and verify that everything will continue as before once it is back up, checking the logs for any errors.

And once that is done repeat the test by restarting other services your app depends on.

No comments:

Post a Comment