Subject Re: [firebird-php] Re: Web Apps - cache lost when db disconnects
Author Helen Borrie
At 23:46 16/10/2008, you wrote:
>--- In firebird-php@yahoogroups.com, Milan Babuskov <milanb@...> wrote:
>
>> Of course, that's the way it works.
>>
>> If you really want to have it cached, use Linux (so filesystem will
>> cache it) or set up some dummy client to get the database attached.
>
>
>Milan,
>
>Thanks for responding. I was reading various threads on the FB
>newsgroup and some people say that OS cache is slower than FB cache.

They are different things. FB's cache fills up with latest copies of pages (data, index) as they are accessed by the engine. It's not used by other applications.


>My workaround has been similar to what you suggested since the
>application opens up a dummy connection that stays alive for 4 hours
>(maybe this connection can stay alive indefinitely according to
>Alexandre Benson Smith). This connection does nothing but keep FB
>cached and certainly speeds up my database response time.

That's how it should be done. It's simple and it doesn't eat much. Alexandre commented on your apparent confusion between a "connection" and a "transaction". An idle connection doesn't cause any problems (unless your NOS thinks its *too* idle and closes its socket!). Connections have a socket stay-alive mechanism.

Long-running transactions do cause problems if they are read-write, or if they are read-only but not in Read Committed isolation. There are dumb interface layers around that keep a read-write transaction running all the time by some kind of auto-commit mechanism that uses CommitRetaining. If you suspect the php driver is guilty of that...then the proposed driver mods would need to address it because it can cause the problem that people have warned you about.

Helen