Back Home Up Next
| |
Cache configuration.
The database cache is the chunk of volatile memory (RAM)
where the engine keeps the most recent data for fast retrieval. This improves
performance as opposed to disk reads. There're two types of cache settings:
- The database cache itself, measured in pages, is the size of the buffer
kept by the engine as long as there's at least one attachment to that
database. Each database kept open by the engine has its separate cache.
- The client map size, measured in pages, is the size of the communication buffer for each
IB client and is only meaningful for local clients, namely, clients that are
in the same machine than the database. Therefore, this setting is important
for the DBA working locally with the engine and in standalone, single-user
applications using IB as a silent companion.. Also, this is only meaningful
in platforms where a local connection is possible, for example, in Windows
NT (through IPC).
A page is defined as a memory unit, not necessarily the same than the
operating system's page size in memory or to the file system's cluster size or
block size on a hard disk's partition. Since IB's roots are in the years when a
workstation with 4 MB RAM was considered a luxury and small IBM mainframes
exhibited 16 MB RAM, the default page size has been set to 512 KB, so the engine
allocates small chunks on disk space and small chunks on RAM.
There are different levels of specifications for the database cache, always
in number of database pages, from the most generic to the most specific:
- The engine itself comes with a predefined default, 256 pages of 512 KB
each one. Those values are hard coded in the engine. It's the global setting
for the cache size used for each database touched by the engine. Remember
each database when opened gets its own cache in RAM.
- In the configuration file, (ibconfig in Windows and isc_config in UNIX),
those global settings can be changed. In fact, the configuration file comes
with the default values commented with "#" before.
- Using gfix or an equivalent utility, the setting is for a specific database.
This overrides the prior engine's cache size for this database. If the
database setting is left as zero, the engine's default applies.
- At connection time, using the parameters in the API, an specific
attachment can be made with an specific cache size that overrides the global
setting (but not the database setting, if the db setting is greater than
zero). This value only is honored if it's greater than
the value being used by other connections already active on the same
database.
The facts are complicated by the presence of two IB architectures in some
platforms since IB4.2 on Windows introduced the Super
Server design. In Classic, since each connection is handled by a separate
process, each connection has its own cache that must be kept consistent with
other cooperating server processes working on the same database. Conversely,
Super Server handles all connections inside one process with multiple threads,
so one database gets effectively one cache, since threads by design share the
address space of the owning process.
Usually, the manual known as "Operations Guide" describes in
details the available settings for tweaking and configuring IB. Also, see this
article on cache settings
priority.
|