Magento Expert Forum - Improve your Magento experience

Results 1 to 3 of 3

Apachebench tutorial ab testing Tool in Ubuntu

  1. #1
    Administrator david's Avatar
    Join Date
    Nov 2012
    Posts
    261
    Thanks
    22
    Thanked 42 Times in 34 Posts

    Default Apachebench tutorial ab testing Tool in Ubuntu

    Is there a time when you are thinking how to do a server load testing to evaluate your PHP web application performance? This is where you will be using the Apachebench or “ab” testing tool. This is a very useful open source tool not only to PHP developers but to the entire users of the Apache server. This tool is used to evaluate the execution times of your PHP web application or the response time of your website under “stressing” conditions. This condition means how your PHP web application will perform under conditions similar to what exactly will be happening on a real web server not just on your local host environment (such as XAMPP). For example in actual website deployment in a production server; it will be subjected to two stressing conditions:

    a.) Number of connections to that application – these are the number of visitors to your website which are connected to that application. The higher the number of visitors to that application, the higher also the number of connections. This is a stressing condition because sometimes if your PHP web application in your website is poorly written, it will result to a very poor performance in actual deployment which can slowed down if there are a lot of users in your website.

    b.) Number of concurrent users – these are the actual number of users that are using the application at exactly the same time. Of course in a very low traffic website, the concurrent users is almost zero because the probability that two users will exactly hit the application and do the same request is very small. This can be an issue with high traffic websites; it is because the number of concurrent users can slowed down the application and put a signficant load on the web server. Some web host even limits the number of concurrent users (typically those that are originating from a free web hosting scheme).

    The good thing with Apachebench is that you measure the performance of a certain web application or website given a stress conditions. The stressing conditions required by Apache bench are two above. What is expected to happen is that a poorly written PHP web application will perform poorly under stressing conditions. This is why performance benchmarks of CMS, PHP frameworks, etc are using ab testing to evaluate the quality of the application.

    How to Get Started with AB testing tool in Linux/Ubuntu:


    Below are the steps :


    1.) In Ubuntu, Apachebench can be installed using the Apache 2 utils. Go to Applications – Accessories – Terminal, at the command prompt type:

    Code:
    sudo apt-get install apache2-utils
    2.) After installation, you are now ready to use Apachebench. Lets have an example. Supposing you will need to know how magentoexpertforum.com performs when there are 300 connections and 3 concurrent users. First, this is the syntax of ab:

    Code:
    ab -n [number of connections] -c [number of concurrent users] [url]
    3.) Using the syntax above for ab test, below is the final command to type in the shell prompt:

    Code:
    ab -n 300 -c 3 http://magentoexpertforum.com/
    4.) Below are the results, you should see in your terminal:

    Code:
    This is ApacheBench, Version 2.3 <$Revision: 655654 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    
    Benchmarking wordpress.org (be patient)
    
    Completed 100 requests
    Completed 200 requests
    Completed 300 requests
    Finished 300 requests
    
    
    Server Software:        nginx
    Server Hostname:       magentoexpertforum.com
    Server Port:            80
    
    Document Path:          /
    Document Length:        9172 bytes
    
    Concurrency Level:      3
    Time taken for tests:   72.917 seconds
    Complete requests:      300
    Failed requests:        296
       (Connect: 0, Receive: 0, Length: 296, Exceptions: 0)
    Write errors:           0
    Total transferred:      2789682 bytes
    HTML transferred:       2743782 bytes
    Requests per second:    4.11 [#/sec] (mean)
    Time per request:       729.172 [ms] (mean)
    Time per request:       243.057 [ms] (mean, across all concurrent requests)
    Transfer rate:          37.36 [Kbytes/sec] received
    
    
    Connection Times (ms)
    
                  min  mean[+/-sd] median   max
    Connect:      214  225   6.8    224     253
    Processing:   448  502 177.6    486    3481
    Waiting:      221  252 175.9    237    3232
    Total:        670  728 179.0    710    3722
    
    Percentage of the requests served within a certain time (ms)
      50%    710
      66%    721
      75%    728
      80%    735
      90%    751
      95%    771
      98%    818
      99%    931
     100%   3722 (longest request)
    Very important interpretation of results:


    1.) It means it takes 3722ms for wordpress.org to serve longest request under a stressing conditions of 300 connections and 3 concurrent users. This is the longest response time.


    2.) But on the “average” it will only take wordpress.org to respond within 728ms +- tolerance of 179 ms.


    A more powerful and faster website can respond to faster times even with more stressing conditions. If you are using Windows, you can read this Apachebench tutorial using Windows OS.

    Warning: Do not use Apachebench excessively to make enormous request to a web server that you do not own. This is a form of denial of service attack and can put you to jail: http://www.pcworld.com/businesscente...ial_of_service

    View more threads in the same category:


  2. #2
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    228
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Sep 7, 2016 - Apache Bench (stomach muscle) is a typical device for estimating the exhibition of HTTP servers in a Linux domain. It works by creating a surge of solicitations to a given URL and returns some effectively absorb able exhibition related measurements to the screen. ... The main alternative when running a heap test

  3. #3
    Junior Member
    Join Date
    Sep 2018
    Location
    Oman, Muscat
    Posts
    2,084
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    The ApacheBench apparatus (stomach muscle) can stack test servers by sending a self-assertive number of simultaneous solicitations. Despite the fact that abdominal muscle was intended for testing Apache establishments, it very well may be utilized to benchmark any HTTP server. In this instructional exercise, we will perceive how a Ruby translator with various servers performs under burden.

Similar Threads

  1. Install FileZilla in Ubuntu - Tutorial
    By david in forum PHP programming
    Replies: 1
    Last Post: 14-03-2019, 07:47 AM
  2. How to view Ubuntu version in Terminal
    By david in forum PHP programming
    Replies: 1
    Last Post: 14-03-2019, 07:41 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •