Subject Re: Webserver crash due to Ibase problems
Author Mikael Krogius
Hi again,

> php session files, if you have concurrent requests going
> on using a single session id then those requests have to be

Am not using sessions at all. All data is stored in the FB database,
and users are identified using WML variables (It's a WAP chat). It
just occured to me that if I move at least some of the userdata to
session variables it would ease the load of the FB server as the chat
does at least two SELECTs for each pageload at the moment, one for
userdata and one for reading chat messages. Users have their own PHP
object so the change would perhaps not be overwhelming, allthough some
data must remain in the database as the data is accessed by other
users. Maybe i'll try it one day.

Can PHP sessions be identified with a URL variable? Cookies and WAP do
not mix very well...

> are you explcitly calling ibase_commit() / ibase_rollback() ?
> if not the whole transaction will be held up until the end of
> request.
> are you using ibase_connect() or ibase_pconnect() ?
> have you tried opening a readonly transaction for those queries that
> are just SELECTing stuff?

Am using ibase_connect() and explicitly using ibase_commit and
ibase_commit_ret. There is no transaction that is rolled back. I
tested with ibase_pconnect() but that only resulted in a
overload-disaster...

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):
* Changed all Read-only queries to use their own transaction thats a
IBASE_READ and/or IBASE_CONCURRENCY (dirty read)
* Changed all SELECT queries to select only the fields I need and not
selecting * when I only need the data from less then all fields.
* Have minimized code that use UPDATE/DELETE by instead having
temporary tables where data is Inserted - and then occasionally I
gather data from those tables.
* Keeping the tables as small as possible by deleting all data that is
no longer needed.
* Rewriting a lot to optimize and combine requests that did not need
to be done separately

> you have got good indexes right?

To be honest, I am not fully familiar with all the indexing
possiblities of FB databases. The main tables that are used a lot do
have an IDX field that is autoincremented by FB.

Very strangely I sometimes (regularly) get empty results when doing
SELECT queries, even though there should be a result (checked with a
Console the data is there using the same SELECT query). But no errors
happen anywhere - the query just returns 0 rows.

- Mikael