Why is database cache not used by Firebird with my web application?
Firebird loads the page cache upon first attachment (connection) to the database. When the last client disconnects, the memory used by cache is freed. This can be a problem with web applications (PHP, ASP, ...) that have short transactions in a 'connect-execute-disconnect' style, but also with regular appplications that don't keep the connection open. The problem is not noticeable on Linux as the operating system caches the filesystem in memory even after the application exists. However, on Windows, the memory is released instantly, and data needs to be loaded from the disk each time.
If you use Windows, you can work around this problem by having a single connection that does nothing: just connect and sit there - don't start a transaction as it would make your tranasction gap growing. Please note that many tools and libraries start implicit transaction when you log in, so you better use something that doesn't do that.
On Linux, it is wise to reduce the DefaultDbCachePages setting in firebird.conf to lessen the number of pages that are preloaded at each connection - filesystem would cache the often used pages anyway.
Some of the connection libraries offer persistent connections. For example, in PHP you can use ibase_pconnect instead of ibase_connect. Nigel Weeks pointed to us that when using this on a Unix machine wich Apache in PreFork mode, it will start up a Firebird Classic process for each Apache process thatís running. Since this is Classic, each process will maintain it's own database cache, so make sure you limit the number of concurrent Apache processes that can run.