I have a application that is using /opt/otrs/var/tmp for caching a lot of temporary data. The vendor suggest that one option could be also to put this directory on a ramdisk (If you have enough RAM). My question is what will happen if the RAM-disk gets full ? Is it possible that the OS will swap to the swap partition or is it completely related to the application in question ?


After using RAM it'll use swap, and after consuming all swap you'll likely see the out-of-memory killer kick in, which is rarely a good thing.

If you don't trust the app, worth putting a limit on the maximum size it can consume.

Example, limiting to 50% of RAM.

[root@localhost ~]# mount -o size=50% -t tmpfs none /mnt
[root@localhost ~]# df -h /mnt
Filesystem      Size  Used Avail Use% Mounted on
none            496M     0  496M   0% /mnt
[root@localhost ~]#

Example, limiting to 1,000,000 bytes.

[root@localhost ~]# mount -o size=1000000 -t tmpfs none /mnt
[root@localhost ~]# df -h /mnt
Filesystem      Size  Used Avail Use% Mounted on
none            980K     0  980K   0% /mnt
[root@localhost ~]#

More info at https://linux.die.net/man/8/mount

As you asked specifically about use of tmpfs on OTRS, see also https://doc.otrs.com/doc/manual/admin/stable/en/html/performance-tuning.html#performance-tuning-otrs-cache (relates specifically to OTRS v6 but previous versions have similar, but not identical, approaches)

shell> /opt/otrs/bin/otrs.Console.pl Maint::Session::DeleteAll
shell> /opt/otrs/bin/otrs.Console.pl Maint::Cache::Delete
shell> sudo mount -o size=16G -t tmpfs none /opt/otrs/var/tmp

# add persistent mount point in /etc/fstab
  • tmpfs isn't a ramdisk. – Austin Hemmelgarn May 25 '18 at 19:51
  • Good point, it isn't a ramdisk in the purest sense (it's going to fall back to using swap if memory isn't available). Could use ramfs instead, but has drawbacks (can't df it, can't limit size, etc) – steve May 25 '18 at 19:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.