Howdy, Stranger!

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


Why is allocating a 8GB ramdisk 145x slower than a 2GB?
New on LowEndTalk? Please Register and read our Community Rules.

Why is allocating a 8GB ramdisk 145x slower than a 2GB?

raindog308raindog308 Administrator

I'm on a "big memory" 24GB Linode. 2 cores of "AMD EPYC 7542 32-Core Processor".

I created a 16GB ramdisk (mounted tmpfs).

Using commands such as this, and only changing the count= parameter, I am confused:

time dd if=/dev/zero of=/ramdisk/file bs=1MB count=1024

count=1024 (1GB file) completes in .4 seconds
count=2048 (2GB file) completes in .75 seconds
count=4096 (4GB file) completes in 32 seconds
count=8192 (8GB file) completes in 145 seconds

My theory is that the physical host server can grab 1GB or 2GB of RAM pretty easily and probably has hunks of that size just lying around. But to find 8GB of free memory it has to search what's free more intensely. My mental analogy is going to a parking lot and wanting to park a single car versus showing up and wanting to park 32 cars - the lot has the space but it takes it a little longer to find free spaces.

In other words, that 24GB I'm getting is not reserved specifically to me but is provisioned as-needed, which of course is perfectly legit.

But I could be completely daft on this. Just curious.

Comments

  • CalinCalin Member
    edited April 17

    It depends, if the node you are on has 1 or 2 TB of ram is understandable, as there may be a few dozen VMs on that node , it also depends on what type of partition it is, ZFS or LVM or other similar examples

  • According to the documentation, tmpfs is stored in kernel caches which is something I'm not very familiar with. Maybe someone else here knows more about kernel RAM allocation.

    tmpfs does get swapped if your RAM is relatively full though - How much free RAM do you have?

    By the way, most newer systems already have a ramdisk at /dev/shm

    I created a 16GB ramdisk (mounted tmpfs).

    Did you use the size option to set the size? Note that by default, tmpfs have a max limit of half the RAM (so 12GB in your case).

  • raindog308raindog308 Administrator
    edited April 17

    @Daniel15 said: Did you use the size option to set the size? Note that by default, tmpfs have a max limit of half the RAM (so 12GB in your case).

    Yes:

    mount -t tmpfs -o size=16G ramdisk16 /ramdisk
    
  • It doesn't take that much time to find RAM or else it would have OOM sooner (I think).

    I think the Linode host is RAM overprovisioned and getting swapped. Not dedicated RAM. Binary search between 2048 and 4096 to see where shit goes sideways.

Sign In or Register to comment.