I have several machines with:

  • databse: db2 10.5

  • OS: CentOS 6.9

on some of machines cached memory is high and i need to run this command to free some memory:
echo 3 > /proc/sys/vm/drop_caches

does running this command and clearing cache has any effect on database? if i resize my bufferpools to lower size, value of cached memory will change?

according to kernel:

This is a non-destructive operation and will not free any dirty objects. To increase the number of objects freed by this operation, the user may run `sync' prior to writing to /proc/sys/vm/drop_caches. This will minimize the number of dirty objects on the system and create more candidates to be dropped.

  • 1
    It'll have an effect on the IO caches, obviously. Most RDBMSes have their own internal caches (the Buffer Cache on Oracle, for example), which wouldn't be affected, as they are either part of the actual running service or a shared memory segment – Philᵀᴹ May 14 '19 at 8:15
  • 1
    If Db2 needs a lot of pinned memory, it's usually for a good reason. If this is a production environment, you should benchmark any changes on a realistic non-production environment first. Involve Db2 DBAs in the decision and the measurements, in case Db2 itself can be configured to release memory earlier when it is not required. – mao May 14 '19 at 8:29
  • 2
    @BlackCrystal Why do you think that you need to run this command? Does your system really swap significantly? Db2 may use excessive OS FS cache mainly due to not recommended FS cache setting for the data tablespaces (except those holing LOB data may be), backups with default DB2_BACKUP_USE_DIO registry variable setting. Look at the vm.* kernel parameters Kernel parameter requirements (Linux) – Mark Barinstein May 14 '19 at 10:57
  • @MarkBarinstein i set swappiness to 5 so it doesn't swap a lot. – BlackCrystal May 15 '19 at 2:50
  • @BlackCrystal Did it swap much more before this setting? – Mark Barinstein May 15 '19 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.