InfinityQuest - Programming Code Tutorials and Examples with Python, C++, Java, PHP, C#, JavaScript, Swift and more

Menu
  • Home
  • Sitemap

Python Programming Language Best Tutorials and Code Examples

Learn Python Right Now!
Home
PHP
Stress-Testing Your Website in PHP
PHP

Stress-Testing Your Website in PHP

InfinityCoder December 24, 2016

You want to find out how well your website performs under a heavy load.

Use a stress-testing and benchmarking tool to simulate a variety of load levels.

Stress testing is frequently confused with benchmarking, and it is important to recognize the difference between the two activities.
Benchmarking a website is often a somewhat casual activity when performed by an individual developer.

The most commonly used tool is the Apache HTTP server benchmarking tool, ab, which is designed to test how many requests per second an HTTP server is capable of serving.

For example:

1
% /usr/bin/ab -n 1000 -c 100 -k www.example.com/test.php

This test would return a report illustrating the average response time for requests to http://www.example.com/test.php, based on 1,000 requests, grouped in batches of 100 concurrent requests.
Though that sort of test has value—it gives you a reasonable estimation of how many requests you can serve per second under normal load—it doesn’t tell you much about how your entire web application will behave under heavy load.

It only pounds on one URL at a time, after all. Stress testing is a testing technique whose intent is to break your web application.

By testing to a breaking point, you can identify and repair weaknesses in your application, or gain a better understanding of when you will need to add additional hardware.

When combined with code profiling, you can also get an idea of what part of your application will need to scale first; i.e., will you need to add more servers to your database cluster before you need to add more frontend web server machines?
An excellent open source tool for stress testing is Siege. Siege can be configured to read a large number of URLs from a configuration file and run through them in order (regression testing), or it can read a list of URLs and hit them randomly, which better approximates real-world usage of a website.

Siege can also pound on a single URL in a similar fashion to ab.
If you are unable to install Siege on your system, Lincoln Stein’s torture.pl script is a good alternative.

Many of Siege’s design concepts were inspired by torture.pl, and the two tools produce similar reports.

Share
Tweet
Email
Prev Article
Next Article

Related Articles

Eliminating SQL Injection in PHP
You need to eliminate SQL injection vulnerabilities in your PHP …

Eliminating SQL Injection in PHP

Accessing a Global Variable Inside a Function in PHP
You need to access a global variable inside a function. …

Accessing a Global Variable Inside a Function in PHP

About The Author

InfinityCoder
InfinityCoder

Leave a Reply

Cancel reply

Recent Tutorials InfinityQuest

  • Adding New Features to bash Using Loadable Built-ins in bash
    Adding New Features to bash Using Loadable …
    June 27, 2017 0
  • Getting to the Bottom of Things in bash
    Getting to the Bottom of Things in …
    June 27, 2017 0

Recent Comments

  • fer on Turning a Dictionary into XML in Python
  • mahesh on Turning a Dictionary into XML in Python

Categories

  • Bash
  • PHP
  • Python
  • Uncategorized

InfinityQuest - Programming Code Tutorials and Examples with Python, C++, Java, PHP, C#, JavaScript, Swift and more

About Us

Start learning your desired programming language with InfinityQuest.com.

On our website you can access any tutorial that you want with video and code examples.

We are very happy and honored that InfinityQuest.com has been listed as a recommended learning website for students.

Popular Tags

binary data python CIDR convert string into datetime python create xml from dict python dictionary into xml python how to create xml with dict in Python how to write binary data in Python IP Address read binary data python tutorial string as date object python string to datetime python

Archives

  • June 2017
  • April 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
Copyright © 2021 InfinityQuest - Programming Code Tutorials and Examples with Python, C++, Java, PHP, C#, JavaScript, Swift and more
Programming Tutorials | Sitemap