You are here: Re: Sleepy database « PHP Programming Language « IT news, forums, messages
Re: Sleepy database

Posted by rlee0001 on 03/08/06 05:59

Could be connection overhead. The PHP has to connect to the database
using the TCP connection on first connect. After that the connection is
kept alive for a short period of time for use in subsequent requests.
But this should only really be an issue if the mysql server is on a
seperate machine on a rather slow network.

Alternatively it could be the cache on the database server. On first
load the data has to be loaded from the hard disk into a memory cache
where it is kept for a short period of time. Subsequent accesses can
then draw from the cache directly.

Either way, when your site goes live and you are getting plenty of hits
you shouldn't encounter these delays as all connections and caches
would be kept intact by the load itself. Also, there is most likely
something in your code which is sub-optimal. Analyse your queries
closely and see where you can make improvements. Move as much
processing as possible to the database site when it will result in less
data moving between PHP and MySQL.

You might also want to consider moving to a more capable database such
as PostgreSQL. PostgreSQL has some great features you can leverage for
creating smarter queries such as PL/pgSQL, triggers, stored procedures
and lots more.

-Robert


frizzle wrote:
> Hi group,
>
> I have a site, which content is mostly based on what it finds in a
> mySQL database.
> All queries etc. are performed by PHP. Somehow, no matter what section
> of the
> site (still in test fase) i access, either small, with little DB info,
> or bif with big DB info,
> it seems that when i haven't accessed the page in at least 5 minutes,
> access it again
> the database is a lot slower the first load.
> As if it has to wake up, and get started again. When it has loaded the
> first time, and
> i refresh almost immediately speed is normal again ...
>
> How or why is this happening?
>
> Frizzle.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация