View Single Post
12-22-2011, 08:58 PM
#8
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

I have three scripts. One to create as many rows as possible, one to slowly do fulltext searches though them and one to stress the filesystem. Set a cron to run these as frequently as possible, the server will probably kill all PHP scripts after 30 seconds of execution. If you have a minimum time (such as one minute) set multiple jobs to span over the times. Running together these took my i7 as high as a 50% load, averaging around 20% (which is massive in a shared environment). Make sure the change the DB credentials and $testpath

Create this database
Code:
CREATE TABLE IF NOT EXISTS `test` (
  `hash` varchar(40) NOT NULL,
  `value` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
PHP Code:
<?php
$host
="localhost";
$user="mistake";
$pass="123456";
$db="test";
while(
1)
{
    
$pool="";
    for(
$i=0;$i<10;$i++)
    {
        
$pool="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-=_+[]{};':,./<>?`~!@#$%^&*()";
        
$pool=str_split($pool);
        
$str .= $pool[rand()%(sizeof($pool)-1)];
    }
    
mysql_connect($host,$user,$pass);
    
mysql_select_db($db); //See if they figure out what that stnads for
    
mysql_query("SELECT * FROM test WHERE VALUE LIKE '%" mysql_real_escape_string($str) . "%'") or die(mysql_error());
    
mysql_close();
}
?>
PHP Code:
<?php
error_reporting
(0);        

while(
1)
{
    
$tetpath="http://localhost/testFile.txt";        
    
$myFile "testFile.txt";
    
$fh fopen($myFile'a') or die("can't open file");
    
$content=file_get_contents($textPath);
    
$stringData sha1($content) . $content;
    
fwrite($fh$stringData);
    
fclose($fh);
}
PHP Code:
<?php
error_reporting
(0);
$host="localhost";
$user="mistake";
$pass="123456";
$db="test";


while(
1)
{
    
$pool="";
    
    for(
$j=0;$j<40;$j++)
    {
        
mysql_connect($host,$user,$pass);
        
mysql_select_db($db); //See if they figure out what that stnads for
        
$pool="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-=_+[]{};':,./<>?`~!@#$%^&*()";
        
$pool=str_split($pool);
        
$str .= $pool[rand()%(sizeof($pool)-1)];
        
mysql_query("INSERT INTO test VALUES ('" sha1($str) . "','"mysql_real_escape_string($str) . "');");
        
mysql_close();
        
$myFile "testFile.txt";
        
$fh fopen($myFile'a') or die("can't open file");
        
$stringData =  $str;
        
fwrite($fh$stringData);
        
fclose($fh);
    }

}
?>

Thanked by:
Artashes (12-22-2011)