Articles How to force caching of Firebird database to file cache of OS by IBSurgeon Team

emailx45

Местный
Регистрация
5 Май 2008
Сообщения
3,571
Реакции
2,438
Credits
573
How to force caching of Firebird database to file cache of OS
IBSurgeon Team - ?
[SHOWTOGROUPS=4,20]
As you know, Firebird uses the file cache of OS intensively (especially on Classic/SuperClassic), and on modern servers, we can often have a lot of RAM, so, potentially, the database file can be 100% cached in RAM.

So, how to force it? (please notice, that question "Is it a good idea to force caching" is not discussed here :))

The fastest way to force caching of the database file to the file cache is to run the database statistics command.
Do the following:
  1. Download Для просмотра ссылки Войди или Зарегистрируйся
  2. Run it and open tab Files, then sort on size, to see the current allocation of memory, make the screenshot
  3. Run the following command:
  4. Код:
    gstat -r localhost:Path/to/your/database -user SYSDBA -pass yourpass > 1.txt
  5. (remember, gstat reads the database from the beginning to the end, so this operation can take a long time, usually depends on the speed of disks)
  6. In RAMMap, hit F5 to renew the memory information
Of course, ## 1,2,4 are needed just to see the effect of #3, and work only on Windows.

In our example, we did gstat for 11Gb database:

Код:
 gstat -r localhost:Path/to/your/database -user SYSDBA -pass yourpass > 1.txt


And then, RAMMap shows the following
rammap_gstat.png



As you can see, the database is fully cached (11Gb, total RAM on this computer is 32Gb).

[/SHOWTOGROUPS]