You are here: Re: application level database connection « PHP Programming Language « IT news, forums, messages
Re: application level database connection

Posted by Erwin Moller on 11/16/06 18:21

rich wrote:

> I have a PHP5 application that accepts external messages, and inserts
> them into a database. It's rather high traffic.. the server could be
> receiving thousands at a time, and recently mysql has been locking up
> because it's exceeding the max_connections limit. I raised it for now,
> but that's only a temporary fix.
>
> My question is is there a way to make a connection to mysql that
> multiple instances of an object will use together? I'm under the
> impression that something like a singleton would only live on a per
> instance basis, or am I incorrect?

Hi,

I understood that if:
- the same login-credentials (username/password)
- from the same host
are used in your scripts, the connection will be recycled if you use
mysql_pconnect().

Are you using pconnect?

Also have a look at your databasestructure: Is every insert causing some
triggers to run (like Primary Key, Constraints, Indexes)??
Especially Indexes can slow your inserts down. For each insert the Index
must be updated.

If your table IS using Indexes, it might help to:
- do your inserts in a very plain table (ISAM) for storage
- move them one by one to the real (tables) later, when demand on your
server is lower.

Regards,
Erwin Moller

 

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

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