dir_cache - Directory cache support configuration parameter
This parameter determines whether the database, node and DCS directory files will be cached in memory.
- Configuration type
- Database manager
- Applies to
-
- Database server with local and remote clients
- Client
- Database server with local clients
- Partitioned database server with local and remote clients
- Parameter type
- Configurable
- Default [range]
- Yes [Yes; No ]
- When allocated
-
- When an application issues its first connect, the application directory cache is allocated
- When a database manager instance is started (db2start), the server directory cache is allocated.
- When freed
-
- When an the application process terminates, the application directory cache is freed
- When a database manager instance is stopped (db2stop), the server directory cache is freed.
- An application directory cache that is allocated and used for each application process on the machine at which the application is running.
- A server directory cache that is allocated and used for some of the internal database manager processes.
For application directory caches, when an application issues its first connect, each directory file is read and the information is cached in private memory for this application. The cache is used by the application process on subsequent connect requests and is maintained for the life of the application process. If a database is not found in the application directory cache, the directory files are searched for the information, but the cache is not updated. If the application modifies a directory entry, the next connect within that application will cause the cache for this application to be refreshed. The application directory cache for other applications will not be refreshed. When the application process terminates, the cache is freed. (To refresh the directory cache used by a command line processor session, issue a db2 terminate command.)
For server directory caches, when a database manager instance is started (db2start), each directory file is read and the information is cached in the server memory. This cache is maintained until the instance is stopped (db2stop). If a directory entry is not found in this cache, the directory files are searched for the information. Normally, this server directory cache is never refreshed during the time the instance is running. However, an offline backup marks the server directory cache as invalid and will refresh the cache even with the instance running.
Recommendation: Use directory caching if your directory files do not change frequently and performance is critical.
In addition, on remote clients, directory caching can be beneficial if your applications issue several different connection requests. In this case, caching reduces the number of times a single application must read the directory files.
Directory caching can also improve the performance of taking database system monitor snapshots. In addition, you should explicitly reference the database name on the snapshot call, instead of using database aliases.