`

More on performance vs. load testing

阅读更多

I recently got some comments/questions related to my previous blog entry on performance vs. load vs. stress testing. Many people are still confused as to exactly what the difference is between performance and load testing. I've been thinking more about it and I'd like to propose the following question as a litmus test to distinguish between these two types of testing: are you actively profiling your application code and/or monitoring the server(s) running your application? If the answer is yes, then you're engaged in performance testing. If the answer is no, then what you're doing is load testing.

Another way to look at it is to see whether you're doing more of a white-box type testing as opposed to black-box testing. In the white-box approach, testers, developers, system administrators and DBAs work together in order to instrument the application code and the database queries (via specialized profilers for example), and the hardware/operating system of the server(s) running the application and the database (via monitoring tools such as vmstat, iostat, top or Windows PerfMon). All these activities belong to performance testing.

The black box approach is to run client load tools against the application in order to measure its responsiveness. Such tools range from lightweight, command-line driven tools such as httperf, openload, siege, Apache Flood, to more heavy duty tools such as OpenSTA, The Grinder, JMeter. This type of testing doesn't look at the internal behavior of the application, nor does it monitor the hardware/OS resources on the server(s) hosting the application. If this sounds like the type of testing you're doing, then I call it load testing.

In practice though the 2 terms are often used interchangeably, and I am as guilty as anyone else of doing this, since I called one of my recent blog entries "HTTP performance testing with httperf, autobench and openload" instead of calling it more precisely "HTTP load testing". I didn't have access to the application code or the servers hosting the applications I tested, so I wasn't really doing performance testing, only load testing.

I think part of the confusion is that no matter how you look at these two types of testing, they have one common element: the load testing part. Even when you're profiling the application and monitoring the servers (hence doing performance testing), you still need to run load tools against the application, so from that perspective you're doing load testing.

As far as I'm concerned, these definitions don't have much value in and of themselves. What matters most is to have a well-established procedure for tuning the application and the servers so that you can meet your users' or your business customers' requirements. This procedure will use elements of all the types of testing mentioned here and in my previous entry: load, performance and stress testing.

Here's one example of such a procedure. Let's say you're developing a Web application with a database back-end that needs to support 100 concurrent users, with a response time of less than 3 seconds. How would you go about testing your application in order to make sure these requirements are met?

1. Start with 1 Web/Application server connected to 1 Database server. If you can, put both servers behind a firewall, and if you're thinking about doing load balancing down the road, put the Web server behind the load balancer. This way you'll have one each of different devices that you'll use in a real production environment.

2. Run a load test against the Web server, starting with 10 concurrent users, each user sending a total of 1000 requests to the server. Step up the number of users in increments of 10, until you reach 100 users.

3. While you're blasting the Web server, profile your application and your database to see if there are any hot spots in your code/SQL queries/stored procedures that you need to optimize. I realize I'm glossing over important details here, but this step is obviously highly dependent on your particular application.

Also monitor both servers (Web/App and Database) via command line utilities mentioned before (top, vmstat, iostat, netstat, Windows PerfMon). These utilities will let you know what's going on with the servers in terms of hardware resources. Also monitor the firewall and the load balancer (many times you can do this via SNMP) -- but these devices are not likely to be a bottleneck at this level, since they usualy can deal with thousands of connections before they hit a limit, assuming they're hardware-based and not software-based.

This is one of the most important steps in the whole procedure. It's not easy to make sense of the output of these monitoring tools, you need somebody who has a lot of experience in system/network architecture and administration. On Sun/Solaris platforms, there is a tool called the SE Performance Toolkit that tries to alleviate this task via built-in heuristics that kick in when certain thresholds are reached and tell you exactly what resource is being taxed.

4. Let's say your Web server's reply rate starts to level off around 50 users. Now you have a repeatable condition that you know causes problems. All the profiling and monitoring you've done in step 3, should have already given you a good idea about hot spots in your applicationm about SQL queries that are not optimized properly, about resource status at the hardware/OS level.

At this point, the developers need to take back the profiling measurements and tune the code and the database queries. The system administrators can also increase server performance simply by throwing more hardware at the servers -- especially more RAM at the Web/App server in my experience, the more so if it's Java-based.

5. Let's say the application/database code, as well as the hardware/OS environment have been tuned to the best of everybody's abilities. You re-run the load test from step 2 and now you're at 75 concurrent users before performance starts to degrade.

At this point, there's not much you can do with the existing setup. It's time to think about scaling the system horizontally, by adding other Web servers in a load-balanced Web server farm, or adding other database servers. Or maybe do content caching, for example with Apache mod_cache. Or maybe adding an external caching server such as Squid.

One very important product of this whole procedure is that you now have a baseline number for your application for this given "staging" hardware environment. You can use the staging setup for nightly peformance testing runs that will tell you whether changes in your application/database code caused an increase or a decrease in performance.

6. Repeat above steps in a "real" production environment before you actually launch your application.

All this discussion assumed you want to get performance/benchmarking numbers for your application. If you want to actually discover bugs and to see if your application fails and recovers gracefully, you need to do stress testing. Blast your Web server with double the number of users for example. Unplug network cables randomly (or shut down/restart switch ports via SNMP). Take out a disk from a RAID array. That kind of thing.


The conclusion? At the end of the day, it doesn't really matter what you call your testing, as long as you help your team deliver what it promised in terms of application functionality and performance. Performance testing in particular is more art than science, and many times the only way to make progress in optimizing and tuning the application and its environment is by trial-and-error and perseverance. Having lots of excellent open source tools also helps a lot.

<!--EndFragment-->
分享到:
评论

相关推荐

    The way to go

    3.8 Go’s performance.....................................................................................................41 3.9 Interaction with other languages.........................................

    [Go语言入门(含源码)] The Way to Go (with source code)

    3.8 Go’s performance.....................................................................................................41 3.9 Interaction with other languages.........................................

    PdfViewer.Demo.rar_DEMO_ESPlatform_PdfViewer.Demo

    PdfViewer.Demoor use more servers to share the load (such as migration to ESPlatform). For more information on ESFramework's performance testing, see the ESFramework 4.0 Performance Test.

    pro_apache_third_edition..pdf

    Contents About the Author...............................................................................................xix About the Technical Reviewer and Contributing Author.................xxi ...

    EurekaLog_7.5.0.0_Enterprise

    3)....Added: IDE F1 help integration (on CHM-based IDEs only, i.e. XE8+) 4)....Added "--el_injectjcl", "--el_createjcl", and "--el_createdbg" command-line options for ecc32/emake to inject JEDI/JCL ...

    hadoop_the_definitive_guide_3nd_edition

    More Distributed Data Structures and Protocols 519 ZooKeeper in Production 520 Resilience and Performance 521 Configuration 522 15. Sqoop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

    PHP.7.Real.World.Application.Development

    Chapter 6: Stress/Load Testing PHP Applications Chapter 7: Best Practices in PHP Programming Appendix A: Tools to Make Life Easy Appendix B: MVC and Frameworks Module 3: Modular Programming with ...

    Complete Guide to Test Automation - 自动化测试从策略到实战大全

    Understand how different types of automated tests will fit into your testing strategy, including unit testing, load and performance testing, visual testing, and more Who This Book Is For Those ...

    BURNINTEST--硬件检测工具

    - PassMark KeyboardTest V2.2 1011 (or higher) for Plugin Keyboard testing. - PassMark Firewire Plugin V1.0 1000 (or higher) and a 揔anguru FireFlash?drive for Plugin Firewire testing. (*) Windows ...

    微软Visual Studio 2017社区版安装文件

    •C++ developers can use CodeLens for unit testing. •We added new rules enforcing items from the C++ Core Guidelines. •Debugging large solutions with /Debug:fastlink PDBs is more robust. •CMake ...

    php.ini-development

    On production servers, 4096 bytes is a good setting for performance ; reasons. ; Note: Output buffering can also be controlled via Output Buffering Control ; functions. ; Possible Values: ; On = ...

    jQwidgets 3.6.0

    Don抰 spend time testing on different devices and browsers. Use a reliable, CSS compliant JavaScript library based jQuery, ...

    JavaScript Applications with Node.js, React, React Native and MongoDB

    13.4Performance and Load Testing 13-5Running Lint Chapter 14: DevOps Service Laver Tips 14.1Console Logging 14.2CPU Profiling 14.3. Memory Leak Detection 14.4CI/CD 14.5Monitoring and Alerting PARTIII:...

    Heterogeneous Computing with OpenCL 2.0 3rd pdf

    Designed to work on multiple platforms, OpenCL will help you more effectively program for a heterogeneous future. Written by leaders in the parallel computing and OpenCL communities, this book ...

    VST SDK 3.612

    1. Improved Performance with the Silence Flag Processing can optionally be applied to Plug-ins only when audio signals are present on their respective inputs, so VST 3 Plug-ins can apply their ...

    Sakemail

    just go tohttp://groups.yahoo.com/group/sakemail/History:0.9 - First released version0.9.1b -Fixed when a mail server reply on the connection with more than one line0.9.2b - I forget to return a ...

    Microservices From Day One(Apress,2016)

    It also describes best practices for documenting and generating APIs and client libraries, testing applications with service dependencies, optimizing services for client performance, and much more....

    React Design Patterns and Best Practices

    Use server-side rendering to make applications load faster Build high-performing applications by optimizing components About the Author Michele Bertoli is a frontend engineer with a passion for ...

    微软内部资料-SQL性能优化3

    Intent locks improve performance because SQL Server examines intent locks only at the table level to determine whether a transaction can safely acquire a lock on that table. This removes the ...

    ramin 2.2 for xp

    performance loss. IP Filter Allows an access to the Radmin server only from specified IP addresses and subnets. Radmin Supports High-Resolution Modes Display resolutions up to 2048 X 2048 X 32 bit...

Global site tag (gtag.js) - Google Analytics