I'm trying to use some sort of ramdisk using tmpfs on a system with about 1TB of system memory.
However, there is a problem that the speed of reading and writing files to memory is less than 100MB/s, which is very slow.
I suspect this issue is caused by the block size being very small at 4K.
Since 99% of the files are between 22MB and 40MB in size, and the total number of files is no more than 10000, I want to create a tmpfs with blocksize of 2M.
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=256G,huge=always none /mnt/ramdisk
After creating tmpfs with the following command, I created a file and checked the stat of the file, but it still has a block size of 4K.
touch /mnt/ramdisk/any.txt
stat /mnt/ramdisk/any.txt
File: /mnt/ramdisk/any.txt
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 35h/53d Inode: 235 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1002/ ubuntu) Gid: ( 1004/ ubuntu)
Access: 2022-11-01 14:03:22.245710790 +0900
Modify: 2022-11-01 14:03:22.245710790 +0900
Change: 2022-11-01 14:03:22.245710790 +0900
Birth: -
Am I trying wrong?
I would like to know how to properly create tmpfs to handle large files.
I'm really sorry, but I'm not sure if the block size is a concept of virtual memory (ram + swap) or a concept of filesystem, so it may have been written in confusion.