Subject Re: [firebird-php] Re: Webserver crash due to Ibase problems
Author Lester Caine
Mikael Krogius wrote:

> --- I wrote:
>>I have gotten the chat to work better (= less deadlocks / errors) by
>>doing the following (that might help others if they face the same
>>kinds of problems):
> Just FYI I thought I would mention that the chat currently gets ca
> 400000 page requests per day which translates to 277 requests per
> minute = 4,6 requests per second. Each request generates a minimum of
> 6 sql SELECT/INSERT queries to 3 different tables (this could still be
> optimized), but might in some rare cases do up to 15 queries depending
> on what the user does.
> As a reslut, the chat generates a mimimum average of ~28 sql queries
> per second (=2419200/day) to the FB database.
> (note: that this is the average, during peak hours it's probably at
> least twice as high)
> Don't know if this would be considered "heavy" use, but avoiding
> deadlocks require that some thought is put into the code...

Fairly heavy - I don't get up to anything like that high ;)
Did we establish - are you running a stand alone database server, with a
separate machine running Apache/PHP?
All my 'heavy' systems have a separate machine and while the load is
probably a hundereth, it makes a lot of difference.

It sounds like you have already 'optimised' all the queries, but could
you perhaps cache some of the information that is most accessed, so
removing some of the general queries? Another trick here - to cope with
slow links - is to run multiple copies of Firebird on slave machines and
do all the read stuff from the local copy. The updates are then pumped
as required. Probably not practical in your case, but makes the system
more robust, since multiple machines spread the load :)

Lester Caine
L.S.Caine Electronic Services
Treasurer - Firebird Foundation Inc.