March 22, 2012 10:13AM
Serving static files is the native behavior of nginx, and when we use gateway for scripting, it needs more works by nginx. Thus, loading a php file should take more time than loading an image file.

I compare the speed of loading an image file with serving via php by

$image=imagecreatefromjpeg($imagepath);
header('Content-Type: image/jpeg');
imagejpeg($image);

Surprisingly (at least to me), the speed of loading the image via php was 50 - 70% faster than loading the original image file directly. What is the reason for this peculiar behavior?

I tested with Pingdom. The difference was in Receive step, which is associated with downloading the data.
Subject Author Posted

Serving direct static image vs via php

etrader March 22, 2012 10:13AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 69
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready