Firebird server is very slow, using 100% of system resources, etc.
There are various possible reasons for this. Here are some things that you can check:
- Database queries that are not optimized. In Firebird 2.1 and higher you have monitoring tables, so you can detect which query is causing problems. Once you isolate it, check the query plan and try to change it to use indexes wherever possible.
- There are common problems with the usage of filesystem cache. Firebird stores an in-memory copy of the database file from the hard disk. The cache is big for SuperServer since all connections share the same cache. However, on most modern operating systems, the filesystem stores a cache of its own, thus duplicating the same thing in RAM twice. This is especially evident on Linux where all of RAM is in use all the time (whatever is not used for applications is used by filesystem cache). Sometimes the Firebird cache and filesystem cache could be so big that they exceed the physical RAM and some of it goes into swap space. This can hog the system completely, especially if it swaps back and forth all the time. You should not set the cache size to consume large part of your RAM. In newer Firebird versions, there's the MaxFileSystemCache parameter in the firebird.conf file. Make sure you read the release notes before using it.
- If you're using .gdb as file extension, make sure you read FAQ #353