gzip huge file(~30G) in PHP
does any of you have some experience with compressing huge file in PHP using "gzcompress" ? more efficient is compress the same file in a shell using tar ? To be more exact : such huge file is gzipped directly in PHP. PHP script is running via cron job everyday. My intuition tells me this is slower than executing tar directly in a system shell. But this is still my intuition only :) Question is if it's slower ? If yes than how big the differences can be ? Differences especially when we are t开发者_运维百科alking about execution time.
It doesn't seem like a PHP web job to me. Is this getting gzipped on demand for delivery or transfer? I would put that sort of thing in a queue for processing by a cron job in the shell.
PHP isn't going to be any faster than tar + gzip, and will be much more taxing on your web serving process. I'd redesign the application to add the gzip request to a queue (database, filesystem, whatever), return immediately with "your request is in the works...", and meta refresh the page every N seconds until another process (cron job) has done the work, then return a download link to the completed binary.
精彩评论