Re: [PHP] PHP+MySQL website cache ? Yes/No



This benchmark is not very accurate, but you are right the database connection took most of the time.

Shopping cart is stored in session - not in database.

I am half-way doing the eshop I bet it will took much more than 0.01 sec to generate the final version.

I was going to make this file cache system, but I relies that for each page like (?page=News, ?page=Products etc.) these HTML blocks (Navigation, Recommended) changes and that would mean I would have eventually like 50+ cached files.

One way or another I will always need to connect do database (I cannot cache 300 products in 300 files, can I?). So I decided to put the cache in database table - For each URL Name (news/, products/ etc) a Cache (which will be an array of all HTML blocks).

Martin




lists@xxxxxxxxxxx napsal(a):
Quoting Martin Zvarík <mzvarik@xxxxxxxxx>:

I did a benchmark with and without caching to HTML file and it's like:

0.0031 sec (with) and 0.0160 sec (with database)

I know these miliseconds don't matter, but it will have significant
contribution in high-traffic website, won't it?

Martin

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

Yes it will. And the 0.0129 seconds extra most of it is maybe to create the DB connection. Or are you using a persistent connection and reuseing it?

This benchmark was that together with all other content of the page? I mean including your dynamic shopping cart etc?

/Peter

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


.



Relevant Pages

  • Re: why not SQL Authentication?
    ... >> website thru database) is that connections can't be pooled. ... you can't share/pool that connection. ... >> so in essence you need to cache data. ... then open the command object again. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Sleepy database
    ... The PHP has to connect to the database ... using the TCP connection on first connect. ... Alternatively it could be the cache on the database server. ...
    (comp.lang.php)
  • Re: why not SQL Authentication?
    ... you're going to have to go to the database to get your data. ... Now what doesn't make sense is for me is to close the command object, ... Why wouldn't I just cache that command object so ... that I could just reuse it again without having to set a connection object ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Exception : ResultSet is from UPDATE. No Data
    ... Are you sure that only one thread is using the connection and cached ... > MySQL connections to do various database transactions, ... > maintain PreparedStatement cache, ...
    (comp.lang.java.databases)
  • Re: ADO Connection Timeout
    ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
    (microsoft.public.data.ado)