Re: Uploading Files Should I use MySQL or Server for storage?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A well-optimized and load balanced database-based setup will beat a badly 
configured file system setup, sure.  But will it beat a well-optimized and 
load balanced file system setup?  I would be very surprised.

Really, it comes down to this, assuming you know what you're doing either way.  
Using a database and PHP access script will add overhead to the process.  
Period.  There's extra script execution time, database connection time, 
database read time, and pass-through time.  Plus memory overhead on all of 
those, and coding/debugging time and effort.  What you get in return is more 
places to programmatically control and log things; access-controls for 
whether or not a user is authorized to see a file, potentially more detailed 
access logs than you can get from simple apache logs, etc.  

Sometimes that trade-off will be worth it for whatever it is you're doing.  
Most of the time, it probably won't be.  Decide based on what it is you're 
doing.

On Sunday 20 May 2007, Robert Cummings wrote:
> On Sun, 2007-05-20 at 20:35 -0500, Greg Donald wrote:
> > On 5/20/07, benc11@xxxxxxxxx <benc11@xxxxxxxxx> wrote:
> > > I am in the process of adding a part to my website which would include
> > > pictures, pdf files, txt files, and excel files.  The files sizes
> > > could be anywhere on average of 100k to 2mb.  Do you think I should be
> > > uploading the files to a MySQL database or to my server?
> >
> > http://www.zend.com/zend/trick/tricks-sept-2001.php?id=342
> >
> > [snip]
> > cuts performance by approximately a third
> > [/snip]
>
> Sure, if you use database file storage in the naive way described in the
> document. But I'm quite certain a database stored binary file dispensed
> to multiple servers that keep a locally cached copy for subsequent
> requests beats NFS retrieval hands down. Sure, you could do the same
> caching with the NFS file but then the solution is quite likely just as
> good as the database storage solution. So the 1/3 performance penalty is
> for the naive solution.
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
>
> | InterJinn Application Framework - http://www.interjinn.com |
> |
> :------------------------------------------------------------:
> :
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for       |
> | creating re-usable components quickly and easily.          |
>
> `------------------------------------------------------------'


-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux