Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

RAMFS doesn't uses swap (TMPFS does). So I mount the FS

cd /mnt/; mkdir SOMETHING; mount -t ramfs -o size=1500m ramfs /mnt/SOMETHING; cd /mnt/SOMETHING

I generate a testfile:

dd if=/dev/zero of=testfile_500MB bs=524288000 count=1

I cp the test file (from memory to memory)

time cp testfile_500MB testfile_500MB_cptestfile

real    0m0.599s
user    0m0.008s
sys     0m0.592s

I have one DDR2-1066 module in my PC. What is the bottleneck? According to this wikipedia article:

http://en.wikipedia.org/wiki/List_of_device_bandwidths

it would need to do more then 10 GByte/sec! It's waay not more 10 GByte/sec

500 MByte in 0.599 sec = 835 MByte/sec. It's slow.

Is the CPU the bottleneck? OR what? :O (E7300 @ 2.66GHz)

UPDATE: is measuring a "cp" with "time" a good thing?

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

Your test probably isn't long enough to average out the overhead of running cp, so I don't know if that's a good test. You might want to try something like bonnie++.

Still, the number you came up with doesn't seem unreasonable to me. If memtest86+ is to be believed, most systems with dual-channel RAM will do 2-3GB/s to main memory. Single-channel (as you have with only one stick of RAM) is going to be less (but not necessarily half). Subtract some understandable overhead, and a bit less than 1GB/s sound plausible.

share|improve this answer
    
If you take your number and multiply by 2 (since you're reading and writing at the same time), it means memtest86+ is probably right and there's not much overhead in using ramfs. –  Steven Pritchard Aug 1 '11 at 18:27
add comment

Using cp, the data will go through several buffers (user side and kernel side), so the memory bandwidth required can be multiplied by a big factor. Maybe ramfs internals will also add some overhead. So, cp is definitely not a good tool to test memory bandwidth.

There must be some specific tools lying around for that.

share|improve this answer
add comment

Actually it's even slower than you think. If you create a file in this way it should be sparse and by default filesystems are mounted with asynchronous I/O.

Certainly cp is well known for being rather slow at copying large files (there are various ways to address this - the most common being to use cpio across a pipe).

What is it you are trying to measure the speed of? If you want to measure your memory I/O, use memtest. If you want a realistic measure of ramfs performance, use fio

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.