Performance testing and measurement tools

These tools fall under two broad categories—namely, the ones used for performance testing and diagnostics, and the ones used for performance metrics gathering and instrumentation.

Performance testing and diagnostic tools can be classified further as follows:

  • Stress-testing tools: These tools are used to supply workload to the system under test, simulating peak workloads in production. These tools can be configured to send a continuous stream of input to the application to simulate high stress or to periodically send a burst of very high traffic—much exceeding even peak stress—to test the robustness of the system. These tools are also called load generators. Examples of common stress testing tools used for web application testing include httpperf, ApacheBench, LoadRunner, Apache JMeter, and Locust. Another class of tools involves those that actually record real user traffic and then replay it via the network to simulate real user load. For example, the popular network packet capturing and monitoring tool, Wireshark and its console cousin program, tcpdump, can be used to do this. We won't be discussing these tools in this chapter as they are general-purpose and examples of usage for them can be found in abundance on the web.
  • Monitoring tools: These tools work with the application code to generate performance metrics such as the time and memory taken for functions to execute, the number of function calls made per request-response loop, the average and peak times spent on each function, and so on.
  • Instrumentation tools: Instrumentation tools trace metrics, such as the time and memory required for each computing step, and also track events, such as exceptions in code, covering such details as the module/function/line number where the exception occurred, the timestamp of the event, and the environment of the application (environment variables, application configuration parameters, user information, system information, and so on). Often external instrumentation tools are used in modern web-application programming systems to capture and analyze such data in detail.
  • Code or application profiling tools: These tools generate statistics about functions, their frequency of duration of calls, and the time spent on each function call. This is a kind of dynamic program analysis. It allows the programmer to find critical sections of code where the most time is spent, allowing them to optimize those sections. Optimization without profiling is not advised as the programmer may end up optimizing the wrong code, thereby not surfacing the intended benefits up to the application.

Most programming languages come with their own set of instrumentation and profiling tools. In Python, a set of tools in the standard library (such as the profile and cProfile modules) do this—this is supplemented by a rich ecosystem of third-party tools. We will discuss these tools in the coming sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.47.218