We have made an app that displays dynamic images. We are trying to handle a load of 2k image request a second with nginx. The size of the image is about 0.13 mb and we are using php with this code to serve the image:
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment;filename="'.$file.'"');
echo file_get_contents($file);
When we load the server with 7500 request in 30 sec (250 a sec) we get this response: screenshot of response
Here the average response is 5461 ms.
We got 4GB Ram
40GB SSD Disk
2 Core vp on digitalocean.com
Any suggestions on what we can do?