Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a PHP script multiple times simultaneously linux command line

I need to test some locking in my PHP script and need to run it many times at the same time.

I remember I found a simple command to do that some time ago when I was testing MySQL locking, but can't remember the function and can't find it again. I'm running Ubuntu Linux 14.04.1.

I'm looking for a simple command without any loops.

Thanks.

like image 824
Jayela Avatar asked Mar 15 '23 10:03

Jayela


1 Answers

Use AB testing in linux

run this command

ab -n 1000 -c 5 http://yourpage.php

where -n 1000 means 1000 times to run it

and where -c 5 means you are going to do 5 concurrent processes

if you want to automate it to happen on its own activate a curl in a cron job

45 11 * * * /usr/bin/curl -G 127.0.0.1/yourscript.php >/dev/null 2>&1

this will run it every day at 11 45 am

See this page for more details about AB testing or benchmark testing in linux

Linux Benchmarking

like image 143
JoeCodeCreations Avatar answered Mar 24 '23 00:03

JoeCodeCreations