1

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?

  • 5
    Don't have PHP send the file. That is slow. Instead have nginx send the file. https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/ – Michael Hampton Oct 24 '15 at 12:05
  • Thank you for the response, it helped alot! Do you have any more suggestions on what i could do, that would be much appreciated. – Lars Erik Fagernaes Oct 27 '15 at 14:26

0 Answers0