0

I have a question which is slightly programming related, but it mostly relates to how ext4 works.

I have a program which writes 128MB to a file with changing random aligned offsets. I write 256KB every write call. Now the speed results are significantly different between the two devices.

I have /dev/sda and /dev/sdb both ext4, while sda is 8GB, sdb is 512MB.

For example, a write task on /dev/sda took 0.7 seconds to complete, while the same write took 0.05 seconds to complete on /dev/sdb. Both partitions are on the same hard disk, which is not an SSD.

EDIT: Sorry I forgot to add that this is running on a virtual machine with VirtualBox with the host being a Windows system. Its definitely only one physical drive because my laptop only has one.

EDIT2: I've found the issue, I was running the program on what I thought to be '/dev/sda' but it was a shared folder the I mounted from the host system. I didn't realize the filesystem will be different.

I'm interested to know what behind of scenes stuff could cause such a dramatic change in performance, thanks!

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
Xsy
  • 103

1 Answers1

2

Since this is a little bit too long for a comment here it goes...

There are two things that got me intrigued:

First of all, /dev/sda and /dev/sdb are two different physical drives, otherwise we would be talking about /dev/sda1 and /dev/sda2. So if we are talking about different physical drives their performances may vary.

Second, in case this info is wrong and we have two partitions on the same drive (/dev/sda1 and /dev/sda2), what is the physical drive size? drives greater than 2TB partitions must be properly alligned otherwise you will have performance issues. Could it be that one of your partitions is alligned while the other one is not? Have you tried testing the partitions speed by other means apart from your program? check this to test drive speeds.

YoMismo
  • 4,015