[nycphp-talk] Writing large files to client efficiently
John Campbell
jcampbell1 at gmail.com
Thu Jan 10 16:14:47 EST 2008
> In your experience, how much slower is fpassthru compared to serving
> static content? Is it twice as slow?
Well, I just tested it and it doesn't appear to make much difference.
You have to fire up the php interpreter either way. I am running
PHP+APC, and I see 4.2 ms for both requests with the redirect method
and 4.7ms per request using fpassthru. (I am testing with ab on the
local machine).
Bandwidth and storage will bite you first anyway.
> Also, regarding fpassthru on multiple servers, do you mean that with
> static files you can redirect to other servers and distribute the
> load?
Yeah that was what I was getting at. You have a lot of options, but I
recommend designing your system so it separates the "what" from the
"where". E.g. you get a request for an asset, determine all of the
places it lives (Amazon S3, Akamai, local server, etc) and then
redirect the request to the best location. How you design the
security is up to you. Hashed file names are one way to go. Some
sort of token system would be another option if you need more
security.
Regards,
John Campbell
More information about the talk
mailing list