Even if running in the Classic (isolated process) mode, Firebird needs some data to be available to all the running server processes. There are four kinds of information that must be shared:
Historically, the files backing the shared memory were located in the root directory if the Firebird installation and thus they were isolated from different Firebird instances. However, this could cause serious troubles if two or more separate Classic instances would occasionally try to access the same database in the read-write mode. Without a shared lock table, they would not synchronize their activity and hence they could easily overwrite each other's changes (in the best case) or just leave the database totally corrupted and unusable (in the worst case).
Also, it should be noted that the shared memory regions were global for the particular server instance. In other words, they handled the shared data for all the databases processed by this server instance. Given the fact that the whole shared memory region is protected by a single mutex, it could cause unexpectedly high mutex wait ratios (and thus degraded performance) if multiple databases were heavily loaded by user connections.
Firebird 2.5 has attempted to improve this situation in two ways:
That said, you can still override the default location with the FIREBIRD_LOCK environment variable. But please don't say you haven't been warned. Make yourself absolutely confident what you are doing and what issues you can expect if the setting has been misused, e.g. not made the same value available for all users/programs or altered at runtime.
- Lock table. It's the vital part of the lock manager and its primary goal is to synchronize access to various resources that can be read or modified simultaneously.
- Event table. Every time a posted event is committed, the server needs to find all the subscribers and redirect the event delivery to processes handling the appropriate user connections.
- Monitoring snapshot. It keeps the latest known state of all the running worker processes and it gets updated once some user connection attempts to access the monitoring tables in a new transaction.
- Trace configuration. It contains the information required for the worker processes to react on the currently active tracing events and log the appropriate notifications.
Historically, the files backing the shared memory were located in the root directory if the Firebird installation and thus they were isolated from different Firebird instances. However, this could cause serious troubles if two or more separate Classic instances would occasionally try to access the same database in the read-write mode. Without a shared lock table, they would not synchronize their activity and hence they could easily overwrite each other's changes (in the best case) or just leave the database totally corrupted and unusable (in the worst case).
Also, it should be noted that the shared memory regions were global for the particular server instance. In other words, they handled the shared data for all the databases processed by this server instance. Given the fact that the whole shared memory region is protected by a single mutex, it could cause unexpectedly high mutex wait ratios (and thus degraded performance) if multiple databases were heavily loaded by user connections.
Firebird 2.5 has attempted to improve this situation in two ways:
- From one side, the shared memory regions (and their backing files) have been made database specific. A separate file and mutex are used for the every database being accessed. So databases are completely isolated now and don't interfere with each other even via the shared resources.
- From another side, they have been made system-wide, i.e. they are visible and can be accessed by different server instances trying to access the same database. So any related database corruption is not possible anymore.
That said, you can still override the default location with the FIREBIRD_LOCK environment variable. But please don't say you haven't been warned. Make yourself absolutely confident what you are doing and what issues you can expect if the setting has been misused, e.g. not made the same value available for all users/programs or altered at runtime.
No comments:
Post a Comment