Jump to content

pdf file database: to compress or not to compress


bad_gui

Recommended Posts

I am a php amateur and have been working on a journal article DB that has the descriptive info in

the DB and the associated article is on the local file system as a pdf.  The user can search for and

read the article in their browser.

 

Some pdf files can be quite large with images etc.  I was wondering if it is worth storing them compressed

with gzip and using the php zlib compression functions to store the article in a gzipped form and gunzip

it when the user requests to view it.  Users can upload new pdf files or download ones they don't have.

 

This is an application to be used internally at a tiny company.  Our servers aren't bad but they are not

cutting edge either.  Sorry don't have specs. Compression of a sample pdf reduced its size by 15%.

 

The trade-off is extra CPU load and my code modifying effort to save on server disk space and I/O?

 

Anyone have any experience with this?

Link to comment
Share on other sites

I would say when the file is originally added it goes in uncompressed.  Run a cron job every 7 days and compress any files that have no been active in that period.  Or some other criteria.

 

Basically aim for a middle ground.  If you compress everything you'll waste too much CPU resources and bog the system down.  If you don't compress the old stuff you'll waste unnecessary disk space.

 

Then again, a few hundred dollars will get you hundreds of gigs of storage space so it might be cheaper to just add a HDD than the hourly cost of you writing this new code.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.