Stress testing php files at Unix/Linux Command line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Stress testing php files at Unix/Linux Command line
# 1  
Old 08-24-2010
Stress testing php files at Unix/Linux Command line

Hi,

Your great help is very appreciated. I am looking for any Unix command or tool for doing Stress/Load test of php files at command prompt.
I tried torture.pl but it is not working after20 concurrent threads/users.

as it is very urgent for me..please suggest ur ideas asap.

thanks
# 2  
Old 08-24-2010
If you have GNU xargs, you can use it to run many processes in parallel with the -P argument.

Code:
echo "a b c d e" | xargs --max-args=1 -P 10 echo

You could use this to run many PHP tasks in parallel.
# 3  
Old 08-24-2010
Hi, Can u explain me indetail?

say I have two php files(a.php & b.php) in a dir called "test"

My requirement is stress testing these two php files by simulating with 1-100 users.
# 4  
Old 08-24-2010
You could do something like:

Code:
for ((N=0; N<10000; N++))
do
        echo a.php b.php
done | xargs -P 100 --max-args=1 php

This should run 100 instances of PHP simultaneously to process 20,000 total requests.

The "-P 100" tells xargs to run up to 100 parallel processes. The --max-args=1 tells it to accept only one argument per process(instead of trying to run several with one single php instance.)
# 5  
Old 08-24-2010
is there anyway of getting the response time or through put measurements?
Basically I want to see Response time of these files as no.of concurrent users increases

thanks for ur prompt responses

---------- Post updated at 01:31 PM ---------- Previous update was at 01:03 PM ----------

I have modified the code to get the response time as below
time( for ((N=0; N<10; N++)); do echo test_performance.php test_performance2.php ; done | xargs -P 10 --max-args=1 php)

the result is as
real 0m42.417s
user 0m29.537s
sys 0m0.399s


which time i need to consider as part of response time?

Last edited by Malleswari; 08-24-2010 at 03:11 PM..
# 6  
Old 08-24-2010
Real time. The others are just a measure of how much time was spent running userspace code or kernel code or just plain waiting.

You could pipe xargs' output into wc -b to count the amount of data in bytes.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

3rd party stress testing services

Hi all, bit of a forum newb here, so apologies if this has been covered else where, but I wonder if any of you has any experience with stress testing servers, specifically using 3rd party services. We run a very busy production system, and just haven't been able to simulate the user activity while... (1 Reply)
Discussion started by: dare99
1 Replies

2. UNIX for Beginners Questions & Answers

Single line archive log files command if exceed certain limit in Linux

Hello Guys, Is there a single line archive command to zip or tar log files which is larger than certain size limit ? Do let me know if there is any. Thanks (7 Replies)
Discussion started by: UnknownGuy
7 Replies

3. What is on Your Mind?

Saturday May 4th the Forums Will Briefly Break Testing PHP 5.6 to PHP 7.0

On Saturday May 4th the forums will briefly break when I switch our Apache PHP 5.6 module to PHP 7.0. Previously, I had two sites set up for testing the migration, but for many reasons, the second site has additional issues unrelated to PHP 7.0 so it is hard to debug on a different site and... (3 Replies)
Discussion started by: Neo
3 Replies

4. Shell Programming and Scripting

Perl command line option '-n','-p' and multiple files: can it know a file name of a printed line?

I am looking for help in processing of those options: '-n' or '-p' I understand what they do and how to use them. But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.) I did try it and -n works on 2 files. Question is: - is it possible to... (6 Replies)
Discussion started by: alex_5161
6 Replies

5. Shell Programming and Scripting

How to read a two files, line by line in UNIX script and how to assign shell variable to awk ..?

Input are file and file1 file contains store.bal product.bal category.bal admin.bal file1 contains flip.store.bal ::FFFF:BADC:CD28,::FFFF:558E:11C5,6,8,2,1,::FFFF:81C8:CA8B,::FFFF:BADC:CD28,1,0,0,0,::FFFF:81C8:11C5,2,1,0,0,::FFFF:81DC:3111,1,0,1,0 store.bal.... (2 Replies)
Discussion started by: veeruasu
2 Replies

6. Shell Programming and Scripting

linux shell script to take variables from two different files line by line

Friends I need to have a shell script which will feed variables from two different files line-by-line. For example, I have two files - permission and file_name. Contents of permission is - 644 755 .... contents of file_name /file1 /file2 ..... Now I want 644 permission will be... (4 Replies)
Discussion started by: atanubanerji
4 Replies

7. Shell Programming and Scripting

Convert directory of text files to Unix/Linux Line Ending

I need help converting a directory of *.txt with Windows line ending to UTF-8 character encoding and Unix/Linux line ending. (9 Replies)
Discussion started by: chipperuga
9 Replies

8. Programming

Stress testing memory using malloc in linux ??

Hi to all, Recently i am testing an equipment that runs in i586 fedora linux. I have to test mmap function. For that i determined to fill the memory and run the required application to check whether it throws any mmap error regarding low resources. This is the line that does the allocation. ... (3 Replies)
Discussion started by: frozensmilz
3 Replies

9. UNIX and Linux Applications

Solaris & Linux memory stress test?

I'm looking for a script or some other application that will use up a lot of memory on a Solaris or Linux server, in order to test a monitoring application. So far I have found a script that's good for CPU usage but it does nothing for memory. I have also tried the application called 'stress'... (0 Replies)
Discussion started by: Kraas
0 Replies

10. UNIX for Dummies Questions & Answers

testing for regex at command line

hi unixers, i wonder if someone can tell me how i can check for a regex at the command line? if any parameter begins with a special character then do this else do thatthanks for your help. (4 Replies)
Discussion started by: ankimo
4 Replies
Login or Register to Ask a Question