I've heard that it is recommended to use huge pages for the memory used by a TimesTen database. Is that correct? If so how do I configure the OS and TimesTen to ensure that it uses huge pages?
1 Answers
Using huge pages is beneficial if you have a large database and is mandatory if your database will be >= 256 GB in size. You should use explicitly configured huge pages not transparent huge pages. In order to configure the OS suitable you need to:
Determine how many huge pages you need in total (sum of all concurrently active databases). For each database determine the size of the database shared memory segment, divide by the system huge page size (default is 2 MB) and round up. Sum these values to get the number of huge pages. It is vital that you leave enough memory not assigned to huge pages for all other activity on the system.
Edit the file /etc/sysctl.conf and add (or modify) the line
vm.nr_hugepages = N
where N is the value you have determined.
- You also need to add / modify this line
vm.hugetlb_shm_group = timesten_instance_admin_gid
where timesten_instance_admin_gid is the numeric group id of the user who is the TimesTen instance administrator.
Make sure that the TimesTen instance administrator user is allowed to lock enough memory (huge pages are always locked). Normally this is done via entries in /etc/security/limits.conf (memlock parameters) but if you are running the TimesTen daemon under systemd then you need to consult the relevant documentation for how to apply the settings in that environment.
If you had to make any of the changes above, restart your system.
Check that the expected number of huge pages are now configured and available (cat /proc/meminfo).
TimesTen 18.1 and newer will automatically try to use huge pages when creating a database memory segment. If the attempt fails then it will try to fall back to using regular memory instead. So no special configuration is needed on the TimesTen side.

- 81
- 5