List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:February 16 2010 2:23pm
Subject:Re: how things get messed up
View as plain text  
On Mon, Feb 15, 2010 at 10:53 AM, Martijn Tonies <m.tonies@stripped>wrote:

> databases are made for storing data - it saves you on both database and PHP
>> requests, as (from a web point of view) you can't return the image data
>> inside your HTML - it requires a second HTTP call. Filesystem image
>> serving,
>>
>
> Doesn't an image always required additional http calls from the <IMG> tag?


Yes, that's what I'm saying. However, there's a significant difference
between an HTTP call that only needs to pump a file on to the network, and
an HTTP call that needs to start a PHP process that then in turn needs to
connect to the DB, which then needs to parse and execute a query.

Offloading static files (images, css, whatnot) to a separate server that
runs a lightweight, threaded httpd without PHP and whatnot compiled in, also
means that you'll need less hardware to serve the same amount of requests -
our PHP machines typically run 400 apache processes, but a static server on
the same hardware could easily serve a few thousand threads - suddenly it's
not memory/cpu but disk/network bandwidth that becomes your bottleneck.



> If you do go for BLOBs, though, for god's sake keep them in a separate
>> table, lest you fragment your datafiles. Split records are a disaster for
>> performance.
>>
>
> I agree -for MySQL-, but this is a MySQL limitation!! Not a DBMS one.


True. I think (but am too lazy to verify) that even in MySQL this is mainly
an issue with MyISAM, not InnoDB. Given how MyISAM is the default engine,
though, I thought it worthwile to mention.

Separate LOB storage still leaves the overhead of query parsing and other
generic DBMS stuff which isn't there on a filesystem, though, not to mention
that each image requests takes up a database connection for as long as it
takes to transfer the (potentially huge) data. Don't forget that in a
well-tuned database, network transfer is often a significant part of your
total connection lifetime for select statements.



-- 
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel

Thread
how things get messed upJohn G. Heim10 Feb
  • Re: how things get messed upBuford Tannen10 Feb
  • RE: how things get messed upIlya Kazakevich10 Feb
    • Re: how things get messed upCui Shijun11 Feb
      • RE: how things get messed upJerry Schwartz11 Feb
        • Re: how things get messed upJohan De Meersman12 Feb
    • Re: how things get messed upJoerg Bruehe11 Feb
    • Re: how things get messed upJochem van Dieten11 Feb
  • Re: how things get messed upMartijn Tonies11 Feb
    • Re: how things get messed upDavid Giragosian11 Feb
  • RE: how things get messed upJerry Schwartz11 Feb
  • Re: how things get messed upMartijn Tonies11 Feb
    • RE: how things get messed upJerry Schwartz11 Feb
    • Re: how things get messed upAnn W. Harrison12 Feb
  • Re: how things get messed upMartijn Tonies12 Feb
    • Re: how things get messed upJohan De Meersman12 Feb
  • Re: how things get messed upMartijn Tonies12 Feb
    • Re: how things get messed upJohan De Meersman12 Feb
      • Re: how things get messed upVikram A12 Feb
        • Re: how things get messed upJohan De Meersman12 Feb
          • Re: how things get messed upVikram A12 Feb
            • RE: how things get messed upJerry Schwartz16 Feb
              • RE: how things get messed upMartin Gainty16 Feb
                • Re: how things get messed upBarry Leslie17 Feb
              • Re: how things get messed upVikram A18 Feb
                • RE: how things get messed upJerry Schwartz18 Feb
                  • Re: how things get messed upJohan De Meersman18 Feb
  • Re: how things get messed upMartijn Tonies15 Feb
  • Re: how things get messed upMartijn Tonies15 Feb
    • Re: how things get messed upJohan De Meersman16 Feb
      • Re: how things get messed upPaul McCullagh17 Feb
  • Re: how things get messed upMartijn Tonies15 Feb
    • Re: how things get messed upAnn W. Harrison15 Feb
      • Re: how things get messed upJohan De Meersman16 Feb
      • RE: how things get messed upJerry Schwartz16 Feb
  • Re: how things get messed upMartijn Tonies18 Feb
RE: how things get messed upJerry Schwartz22 Feb
  • Re: how things get messed upVikram A24 Feb