/dev/shm and manual mount for latency critical application

General support questions
Post Reply
Eubehi
Posts: 2
Joined: 2018/09/05 12:57:24

/dev/shm and manual mount for latency critical application

Post by Eubehi » 2018/09/05 13:20:44

Hello,

I have a question concerning the /dev/shm and the tmpfs mount. The version of the kernel is the following: 2.6.32-696.16.1.el6.x86_64.

Here is my case:
  • I have 2 applications on my machine, one which is latency critical, the other one which is not;
  • The latency critical application write many files of data (writes are not in the critical path), at high speed (1GB file every 20 seconds in my test);
  • For many reasons, those files are written to ramdisk;
  • The second application consume them, and delete them when done.
I tried to write in 2 different folders:
  1. /dev/shm (default size 48g)
  2. mount -t tmpfs -o size=48g tmpfs /tmp/dummyDir
When writing to the manually mounted folder latencies are worst than when writing to /dev/shm (Transparent Huge Page activated or not, Huge page activated or not (and the latency critical application using them)).

Is there any recommendation about mounting tmpfs folder ? Or is the /dev/shm so particular it is expected to behave "better" than manually mounted folder ?

I could not find much documentation about it :?

aks
Posts: 2538
Joined: 2014/09/20 11:22:14

Re: /dev/shm and manual mount for latency critical application

Post by aks » 2018/09/07 20:10:19

"write in 2 different folders:

/dev/shm (default size 48g)
mount -t tmpfs -o size=48g tmpfs /tmp/dummyDir"

Hmm, I write to shared memory (how?) - and 48GB of shared memory is NOT the default!
I write to disk.

"Is there any recommendation about mounting tmpfs folder ?"

Nope, "use what you need"

"is the /dev/shm so particular it is expected to behave "better" than manually mounted folder ?"

No, it's about your application(s). Yes shm is "particular" - it's not meant to be swapped out to disk - it's meant to be shared memory and shared is the key word (as is memory).

What are you trying to to do?

Also "I could not find much documentation about it" apart from (for example googling /dev/shm): http://man7.org/linux/man-pages/man7/sh ... iew.7.html

Eubehi
Posts: 2
Joined: 2018/09/05 12:57:24

Re: /dev/shm and manual mount for latency critical application

Post by Eubehi » 2018/09/24 06:54:06

Thanks for your answer!
and 48GB of shared memory is NOT the default
From some links (this one in particular), I found that half of the memory is the default (on my machine, I have 96GB of ram).
Nope, "use what you need"
So, only the size is customizable?
What are you trying to to do?
I am trying to impact as less as possible my latency critical application. Some tests showed that using /dev/shm for writing files (not in the critical path, around 1GB of data every 25 seconds), instead of mounting myself a tmpfs gave better latencies.

What you tell me is that /dev/shm and a folder mounted with the tmpfs command shall have the same characteristics ?

Post Reply