Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance, load and stress testing in Django

I am studying the different types of testing for a Django application. I know how to do functional and unit testing in Django and how to apply different methodologies, but now I am facing a new challenge, I need to know how to do:

  • Performance testing
  • Load testing
  • Stress testing

I know the difference between them but I dont know which is the best methodology to follow,which are the best packages for do it or simply where I can get some documentation about it.

So my question is, how can I start to do these types of tests in a Django app or where can I get some good documentation about it?

Thanks

like image 432
Aceconhielo Avatar asked Oct 23 '17 15:10

Aceconhielo


People also ask

What is the difference between performance load and stress testing?

Load testing and stress testing are both types of performance testing, which check how your application performs when many people use it at once. While load testing simulates real-life application load, stress testing tests application performance at peak times.

What is load and performance testing?

Performance testing is the process of determining the system's performance that includes speed, and reliability under varying loads. Load testing is the process of determining the behavior of the system when multiple users access it at the same time. 2. In performance the load on which the system is tested is normal.


1 Answers

Load Testing and Stress Testing are basically performance testing sub-types where:

  • Load testing: is putting the system under anticipated load to see whether performance metrics like response time or throughput match expectations/SLAs
  • Stress testing: is determining system boundaries and/or bottlenecks, i.e. you start the "normal" load test and increase the load until monitored metrics exceed acceptable thresholds or errors start occurring (whatever comes first)

Also, be aware of Soak Testing - when you put the system under a prolonged load to see if it is capable of handling sustained concurrent usage. The majority of bottlenecks are being discovered during Soak Testing phase.


With regards to "how do I":

  1. First of all you need a performance testing tool. Given python and django tags my expectation is that you find Locust tool interesting as you will be able to write your tests in some form of Python language. You can also consider Grinder where you can write tests in Jython (Java bindings for Python) language so you won't have to learn the new tool from scratch. Other free and open source load testing tools are listed and compared in the Open Source Load Testing Tools: Which One Should You Use?

  2. Next step will be creating a load test scenario. You need to mimic real application usage as closely as possible, to wit you need to properly simulate real users using a real browser with all related stuff like:

    • cookies
    • headers
    • cache
    • think times
    • AJAX requests
    • embedded resources handling (images, scripts, styles, fonts)
  3. Once you have the test and have the confidence regarding it is doing what it is supposed to be doing you can run it with an increased number of users and see how does your application behave under the load, correlate increasing/decreasing load with changing metrics/resources usage

like image 172
Dmitri T Avatar answered Oct 01 '22 02:10

Dmitri T