Simple PHP script that returns information about your request. Useful when testing proxy servers. This also serves as a setup for a simple web-server capable of serving thousands of requests per second on a simple VPS.
You need to install Docker on your system first:
curl -sSL https://get.docker.com/ | sh
next, clone this repo and start the containers:
git clone https://github.com/Athlon1600/azenv.git
cd azenv
docker compose up --build -d
✔️ Your server will now start accepting connections on port 80.
ab -n 30000 -c 5000 -r http://azenv.net/test
socket() failed (24: Too many open files) while connecting to upstream
Number of open files on your system is too low. Increase it:
ulimit -n 65535
Increase it permanently by modifying /etc/security/limits.conf
and adding these lines:
* soft nofile 65535
* hard nofile 65535
root soft nofile 65535
root hard nofile 65535
You may also need to increase system limits by adding these modifications below:
echo "net.core.somaxconn = 65536" >> /etc/sysctl.conf
Might have to reboot your system for these changes to take effect.
A slightly different PHP script that returns user's IP address along with their request headers as JSON response. Powered by Swoole server which can easily handle 10K concurrent requests on a 1 GB box.
Uncomment swoole
service inside docker-compose.yml
, and then run:
docker compose up --build -d swoole
alternatively, you can run these:
## for Linux
docker run --rm -v $(pwd)/swoole:/srv -p 9501:9501 phpswoole/swoole:latest php /srv/index.php
## for windows
docker run --rm -v ${PWD}/swoole:/srv -p 9501:9501 phpswoole/swoole:latest php /srv/index.php