Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


ask for /dev/shm + OpenVZ questions
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

ask for /dev/shm + OpenVZ questions

Does it mean that this OpenVZ has a memory overselling.

root@example:/dev/shm# free -h
              total        used        free      shared  buff/cache   available
Mem:           6.0G         30M        5.3G         11M        711M        5.9G
Swap:          6.0G          0B        6.0G
root@example:/dev/shm# dd if=/dev/zero of=1.bin bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.431965 s, 2.5 GB/s
root@example:/dev/shm# free -h
              total        used        free      shared  buff/cache   available
Mem:           6.0G        2.0G        3.3G        1.0G        711M        3.9G
Swap:          6.0G          0B        6.0G
root@example:/dev/shm# rm 1.bin 
root@example:/dev/shm# dd if=/dev/zero of=1.bin bs=1M count=6144
dd: error writing '1.bin': No space left on device
3073+0 records in
3072+0 records out
3221225472 bytes (3.2 GB, 3.0 GiB) copied, 1.32617 s, 2.4 GB/s
root@example:/dev/shm# free -h
              total        used        free      shared  buff/cache   available
Mem:           6.0G        5.3G          0B        3.0G        707M        609M
Swap:          6.0G          0B        6.0G

Comments

  • Default size of /dev/shm is half of your physical memory which is why your dd command couldn't write more than 3GiB.

  • @akb said:
    Default size of /dev/shm is half of your physical memory which is why your dd command couldn't write more than 3GiB.

    I wrote 1GB to /dev/shm and it's taking up 2GB of memory, why?

  • I just remounted to RAM size, indeed I can write the whole disk, I will study why.

  • I think /dev/shm must pay the default fine.

  • @mcgree said: I wrote 1GB to /dev/shm and it's taking up 2GB of memory, why?

    The 1GB file that you wrote is showing correctly as 1.0G under "Shared" column. Rest of the used RAM constitutes file system buffers/cache (711M) plus the memory taken by your processes.

  • @akb said:

    @mcgree said: I wrote 1GB to /dev/shm and it's taking up 2GB of memory, why?

    The 1GB file that you wrote is showing correctly as 1.0G under "Shared" column. Rest of the used RAM constitutes file system buffers/cache (711M) plus the memory taken by your processes.

    I understand this description.

  • yoursunnyyoursunny Member, IPv6 Advocate

    I detected massive RAM overselling using a file in shm folder.

    1. Create a file in /run/shm.
    2. Idle 15 days.
    3. Read the file and record throughput.
    4. Read the file again and record throughput.

    If the file is actually in RAM, both read passes should have the same throughput.

    In the paste below, the first read was 75% slower than the second read, which indicates that the first read was not from DRAM.
    It might be in PMEM that is still considered RAM, but the processor on this server doesn't support Optane DIMM.
    Therefore, I can only conclude the provider is selling disk-based SWAP as RAM,

    $ date
    Sun 26 Sep 2021 05:17:26 AM CEST
    $ ls -l /run/shm
    total 512000
    -rw-r--r-- 1 sunny sunny 524288000 Aug 23 04:45 random.bin
    $ dd if=/run/shm/random.bin of=/dev/null
    1024000+0 records in
    1024000+0 records out
    524288000 bytes (524 MB, 500 MiB) copied, 22.2434 s, 23.6 MB/s
    $ dd if=/run/shm/random.bin of=/dev/null
    1024000+0 records in
    1024000+0 records out
    524288000 bytes (524 MB, 500 MiB) copied, 5.32052 s, 98.5 MB/s
    

    Raw paste: Boomer.host sells SWAP as RAM

Sign In or Register to comment.