Score:0

faster tmpfs with large page size

mh flag
tsp

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.

in flag
Silly question, but have you confirmed that this system has about 300GB of free memory before creating the RAM disk? If the system does not have enough physical memory to allocate for storage *and* the file buffers, then it will write to disk, which may be slow if you're using spinning disks. How did you measure I/O speed?
tsp avatar
mh flag
tsp
@matigo Thanks for the advice. The system has 1020GB of free memory before make tmpfs (except buffer/cached). io speed was measured as the time to move files between two ramdisks. (1000 22-40MB files)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.