I'm running MongoDB on my personal computer. I noticed that performance is much slower when the data are on my 2-recent-spinning-hard-drive-software-RAID1 than when they are on an older spinning hard drive without RAID.
Old drive, no RAID
Single operations:
> var d = new Date(); db.test.createIndex({ "test": 1 } ); print(new Date - d + 'ms');
251ms
> var d = new Date(); db.test.createIndex({ "test": "2dsphere" } ); print(new Date - d + 'ms');
83ms
> var d = new Date(); db.dropDatabase(); print(new Date - d + 'ms');
71ms
Whole test suite: 250s
Recent drives, RAID1
Single operations:
> var d = new Date(); db.test.createIndex({ "test": 1 } ); print(new Date - d + 'ms');
1220ms
> var d = new Date(); db.test.createIndex({ "test": "2dsphere" } ); print(new Date - d + 'ms');
597ms
> var d = new Date(); db.dropDatabase(); print(new Date - d + 'ms');
671ms
> var d = new Date(); db.dropDatabase(); print(new Date - d + 'ms');
1ms
Whole test suite: 700s
Configuration files
In case it would be useful (I doubt it):
/etc/fstab
UUID=d719f337-d835-4688-baf2-3e29f147ff15 / ext4 errors=remount-ro 0 1
# /home was on /dev/md0p3 during installation
UUID=def01643-c71e-47df-9dc8-67096243aee6 /home ext4 defaults 0 2
# swap was on /dev/md0p1 during installation
UUID=d43319a8-92fb-437d-b576-ef964276cde none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
UUID="dd8b1f05-c65b-42e1-a45e-0ef421faf1df" /mnt/bak ext4 defaults,errors=remount-ro 0 1
/etc/mdadm/mdadm.conf
# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR root
# definitions of existing MD arrays
ARRAY /dev/md/0 metadata=1.2 UUID=3a0f91ae:51c48198:3d1e26ed:118a1938 name=bouzin:0
# This configuration was auto-generated on Sun, 24 Jan 2016 18:00:55 +0100 by mkconf
Question
From what I've read, write access on the RAID1 should be roughly equal to the write access on a single equivalent drive.
Could this 5400/7200 factor explain the order of magnitude of difference in the tests above?
Could it be better without the RAID?
Any interesting test/benchmark I could run? For now, I only have Mongo shell tests, but they seem to point to the RAID, or the drives, rather than to Mongo itself. Is there some application-agnostic test I could run to identify anything?
Could anything be wrong or suboptimal with the RAID configuration?
EDIT:
Important is, that I mixed 7200 rpm and 5400 rpm drives.
# swap was on /dev/md0p1 during installationsmartctland see the parametercurrent pending sectors.