Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6850247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:06:02+00:00 2026-05-27T01:06:02+00:00

I’m working on a PHP-MySQL web app, and the available tools for server load

  • 0

I’m working on a PHP-MySQL web app, and the available tools for server load testing are cumbersome and confusing. So I thought I’d try this, and I’d like to know if it’s a bad idea:

  • Add page generation time and memory_get_usage() to the output of each page
  • Use jQuery, AJAX and setInterval to hit the page n-times a second, recording the time/memory consumption.

Here is the Javascript and markup:

<script>
function roundNumber(num, dec) {
    var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
    return result;
}

$(function(){

totalCount = 0;
i = 1;
totalTime = 0;
highest = 0;
memoryUsage = 0;

var hitsPerSecond = 1000;
var totalLimit = 100;

function testLoad(){

            
    if (totalCount <= totalLimit){
        
        $.get('/lp/user-page.php', function(data){
            $(data).filter('#page-generation-time').each(function(){
                totalTime += parseFloat($(this).text());
                $('.console').append('<p>('+i+') - Load time: '+$(this).text()+'</p>');
                            i++;
                            if (highest < $(this).text()){
                                highest = $(this).text();
                            }
                            $('.average').html('Average: '+roundNumber(totalTime/i, 5)+' - Highest: '+highest);
            });
            $(data).filter('#page-memory-usage').each(function(){
                memoryUsage = parseFloat($(this).text());
                $('.memory').html($(this).text());
            });


        });
        
        
    } else {
        clearInterval(testLoadInterval);
    }
    
    totalCount++;

};


var testLoadInterval = setInterval(function(){ testLoad(); }, 1000/hitsPerSecond);

});

</script>

<h2>Load Test</h2>
<div class="average"></div>
<div class="memory"></div>
<div class="console-container">
    <div class="console"></div>
</div>

Is this an incredibly stupid/inaccurate way to do load testing? Because it seems like it has its advantages:

  • Light-weight and easy to implement.
  • Loads the entire page using a real browser.
  • Tracks the average page load time and records the results right in the browser.

But I really don’t have any frame of reference to know if the numbers I’m getting are right. Thanks to anyone who can tell me if I’m completely wrong, and if there’s something slightly more user-friendly out there than jMeter.

UPDATE

Do not use this as a method of server load testing. It will not give you an accurate reading.

Using the above code, I was able to hit the server with "1,000" loads a second with very little problem. After attempting the same with ApacheBench, I’ve found that this was in no way a reflection of reality.

Using ApacheBench, I was able to crash the server by hitting the app with 40 (!) concurrent connections.

Obviously, I’m rewriting parts of the app to use cached HTML wherever humanly possible.

So, to answer my own question, yes, this is a bad way to do server testing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:06:02+00:00Added an answer on May 27, 2026 at 1:06 am

    This isn’t the worst idea, but there are a few problems with it as mentioned in the comments.

    One problem you’re definitely going to have is caching. Just make sure in whatever browser you’re using to turn off the cache. Note: I’ve had some issues with the Chrome cache being turned off and Chrome still insisting on delivering cached content, so watch out for that.

    Beyond caching, this isn’t the most accurate way of doing things. Even though it does simulate a real browser load it’s only simulating one connection. This essentially emulates one user refreshing that single page a bunch of times, not very accurate.

    I’d definitely use apache bench over this just for the concurrent connections. Something like

    ab -n 1000 -c 10 http://www.your_url.com/
    

    Change those numbers around depending on your server. That example would run 1000 requests 10 at a time.

    One thing you could do if you wanted to check the “accuracy” of the numbers of from your javascript benchmark is to run apache bench and get some baseline no-browser number estimates and then run your benchmark script and see how close the results are.

    Another great tool is Siege. It isn’t very difficult to install and is well worth if it you really want to test performance accurately. But if you’re looking for something very user-friendly it might not be up your alley.

    Another potential tool you could use that has a nice interface is Charles

    It isn’t really designed for load testing though, but it does have a feature where you can run repeat concurrent requests (similar to apache bench) and it has a pretty interface.

    There are alot more options out there, but they might not be user-friendly enough for you so I won’t go into much more detail

    One good paid (they give you a few trial runs before charging you) option I’ve used in the past is LoadImpact

    It’s kind of pricey though if you want to do any really heavy duty testing, but it does simulate concurrent browser loads and allows you to script a “path” for the simulated users to take through your site fairly easily. If you’re looking for a VERY user-friendly solution with relatively high accuracy I’d definitely recommend them (if you have the cash).

    Another potential paid solution is CapCal

    I don’t really know much about them though. Looks like they might have some sort of free trial too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.