performance - Use php's readfile() or redirect to display a image file? -


I have a directory with images, CSS and JavaScript outside Webtrust
These files often change
I can write a script that outlines the file, tells the mime type and outputs it in the browser.
or
I can copy the file, copy it to a web-accessible directory, and redirect the file using the header space. When the file is requested again, for the first time there will be an inquiry that the file has been modified, and then there will be a redirect.

What will happen according to better performance? Each request is a readfile, or each request is a timestamp check and redirect (instead of 2 requests)

display First rule of: Benchmark, do not speculate.

I will break the first rule immediately and guess that the readfile will be sharp, because this network terminates the round-trip.

How much performance do you need? The fastest way to do this is to set up a separate static content server under a subdomain on a different machine (for example), and then that web server has to handle frequently-changed image / css / javascript files. / P>


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -