7

At work we are in the middle of a server migration and we want to stress test the new server before starting to migrate our data.

I was wondering if anyone had any ideas for scripts that will put intense load on the processor and/or memory?

It is a linux server running on Red Hat 5 OS and Apache 2.2.1.

It doesn't have to push it to it's physical limits, it's just to use as a benchmark to compare to our old server so we can see how much of an improvement the new setup is over the current/old configuration.

Ideally it would be a shell or php script since php is what will be installed and what we develop in.

martincarlin87
  • 10,848
  • 24
  • 98
  • 145
  • possible duplicate: http://stackoverflow.com/questions/7492/how-do-you-stress-test-a-web-application – OptimusCrime May 11 '12 at 08:59
  • didn't see that question but I think mine is slightly different even though the server will be used for web applications. I want to a script that will take the server a good while to run, not to simulate live traffice and http requests etc. but I will look into the tools mentioned in that question aswell. – martincarlin87 May 11 '12 at 09:10

1 Answers1

13

Write down simple PHP script:

<?php
for($i = 0; $i < 1000000000; $i++) {
     $a += $i;
}

Then write a bash script that will run this PHP script for several times and You will see...

If You want to stress test the server with DB, do a similar one:

for($i = 0; $i < 9999; $i++) {
    $conn = mysql_connect(...);
    $db = mysql_select_db(...);
    $res = mysql_query(...);
    $data = mysql_fetch_assoc($res);
    mysql_close();
}

And again run it from bash for several times...

shadyyx
  • 15,825
  • 6
  • 60
  • 95