* raid io requests not parallel?
@ 2006-07-16 0:04 Jonathan Baccash
2006-07-16 1:07 ` Arjan van de Ven
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Jonathan Baccash @ 2006-07-16 0:04 UTC (permalink / raw)
To: linux-kernel
I'm using kernel linux-2.6.15-gentoo-r1, and I noticed performance of
the software RAID-1 is not as good as I would have expected on my two
SATA drives, and I was wondering if anyone has an idea what may be
happening. The test I run is 1024 16k direct-IO reads/writes from
random locations within a 1GB file (on a RAID-1 partition), with my
disk caches set to
write-through mode. In the MT (multi-threaded) case, I issue them from
8 threads (so it's 128 requests per thread):
Random read: 10.295 sec
Random write: 19.142 sec
MT Random read: 5.276 sec
MT Random write: 19.839 sec
As expected, the multi-threaded reads are 2x as fast as single-threaded
reads. But I would have expected (assuming the write to both disks can
occur in parallel) that the random writes are about the same speed (10
seconds) as the single-threaded random reads, for both the
single-threaded and multi-threaded write cases. The fact that the
multi-threaded reads were
twice as fast indicates to me that read requests can occur in parallel.
So.... why doesn't the raid issue the writes in parallel? Thanks in
advance for any help.
Jon.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
2006-07-16 0:04 raid io requests not parallel? Jonathan Baccash
@ 2006-07-16 1:07 ` Arjan van de Ven
2006-07-16 5:46 ` Avi Kivity
2006-07-16 23:59 ` Neil Brown
2 siblings, 0 replies; 10+ messages in thread
From: Arjan van de Ven @ 2006-07-16 1:07 UTC (permalink / raw)
To: Jonathan Baccash; +Cc: linux-kernel
> So.... why doesn't the raid issue the writes in parallel?
because you use O_DIRECT, which means your application waits for the
write to hit the disk before doing the next write ;)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
[not found] <fa.di4ao4hbHlmvf0KHMl+KieWzn2E@ifi.uio.no>
@ 2006-07-16 1:41 ` Robert Hancock
0 siblings, 0 replies; 10+ messages in thread
From: Robert Hancock @ 2006-07-16 1:41 UTC (permalink / raw)
To: Jonathan Baccash; +Cc: linux-kernel
Jonathan Baccash wrote:
> I'm using kernel linux-2.6.15-gentoo-r1, and I noticed performance of
> the software RAID-1 is not as good as I would have expected on my two
> SATA drives, and I was wondering if anyone has an idea what may be
> happening. The test I run is 1024 16k direct-IO reads/writes from
> random locations within a 1GB file (on a RAID-1 partition), with my
> disk caches set to
> write-through mode. In the MT (multi-threaded) case, I issue them from
> 8 threads (so it's 128 requests per thread):
>
> Random read: 10.295 sec
> Random write: 19.142 sec
> MT Random read: 5.276 sec
> MT Random write: 19.839 sec
>
> As expected, the multi-threaded reads are 2x as fast as single-threaded
> reads. But I would have expected (assuming the write to both disks can
> occur in parallel) that the random writes are about the same speed (10
> seconds) as the single-threaded random reads, for both the
> single-threaded and multi-threaded write cases. The fact that the
> multi-threaded reads were
> twice as fast indicates to me that read requests can occur in parallel.
>
> So.... why doesn't the raid issue the writes in parallel? Thanks in
> advance for any help.
Because it's RAID 1, I'm assuming. The data has to be written to both
drives, unlike reads which can be satisfied from either one.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
@ 2006-07-16 3:17 Chuck Ebbert
0 siblings, 0 replies; 10+ messages in thread
From: Chuck Ebbert @ 2006-07-16 3:17 UTC (permalink / raw)
To: Jonathan Baccash; +Cc: linux-kernel
In-Reply-To: <e0e4cb3e0607151704o479371afpc9332a08fb84ba09@mail.gmail.com>
On Sat, 15 Jul 2006 17:04:57 -0700, Jonathan Baccash wrote:
> As expected, the multi-threaded reads are 2x as fast as single-threaded
> reads. But I would have expected (assuming the write to both disks can
> occur in parallel) that the random writes are about the same speed (10
> seconds) as the single-threaded random reads, for both the
> single-threaded and multi-threaded write cases. The fact that the
> multi-threaded reads were
> twice as fast indicates to me that read requests can occur in parallel.
>
> So.... why doesn't the raid issue the writes in parallel? Thanks in
> advance for any help.
But it does issue writes in parallel. The problem is in the way RAID1
works. When you do a read from the RAID1, it issues one read request
to one of the underlying disks. When you do a write, it issues one write
request to _each_ of the underlying disks. So with two disks in the
mirror set, every write issued by your program causes two disk writes.
--
Chuck
"You can't read a newspaper if you can't read." --George W. Bush
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
2006-07-16 0:04 raid io requests not parallel? Jonathan Baccash
2006-07-16 1:07 ` Arjan van de Ven
@ 2006-07-16 5:46 ` Avi Kivity
2006-07-16 16:38 ` Jonathan Baccash
2006-07-16 23:59 ` Neil Brown
2 siblings, 1 reply; 10+ messages in thread
From: Avi Kivity @ 2006-07-16 5:46 UTC (permalink / raw)
To: Jonathan Baccash; +Cc: linux-kernel
Jonathan Baccash wrote:
>
> I'm using kernel linux-2.6.15-gentoo-r1, and I noticed performance of
> the software RAID-1 is not as good as I would have expected on my two
> SATA drives, and I was wondering if anyone has an idea what may be
> happening. The test I run is 1024 16k direct-IO reads/writes from
> random locations within a 1GB file (on a RAID-1 partition), with my
> disk caches set to
> write-through mode. In the MT (multi-threaded) case, I issue them from
> 8 threads (so it's 128 requests per thread):
>
> Random read: 10.295 sec
> Random write: 19.142 sec
> MT Random read: 5.276 sec
> MT Random write: 19.839 sec
>
> As expected, the multi-threaded reads are 2x as fast as single-threaded
> reads. But I would have expected (assuming the write to both disks can
> occur in parallel) that the random writes are about the same speed (10
> seconds) as the single-threaded random reads, for both the
> single-threaded and multi-threaded write cases. The fact that the
> multi-threaded reads were
> twice as fast indicates to me that read requests can occur in parallel.
>
> So.... why doesn't the raid issue the writes in parallel? Thanks in
> advance for any help.
>
The writes are issued in parallel, but both disks have to be written.
Each head has to service 1024 write requests (compared to just 512 read
requests).
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
2006-07-16 5:46 ` Avi Kivity
@ 2006-07-16 16:38 ` Jonathan Baccash
0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Baccash @ 2006-07-16 16:38 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel
> Each head has to service 1024 write requests (compared to just 512 read
> requests).
By that logic, it would take twice as long for my writes to finish.
Why is it taking 4x as long in my parallel test? I don't think any of
the repliers understood my question. What I want to know is, during a
single direct IO write request, I would expect the raid software to
issue the write request to both disks simultaneously. But the evidence
indicates that isn't what is happening. I would expect a raid-1 write
to take about as long to write a single block as a single write to a
single disk (assuming no other disk activity), because I would expect
two writes to happen concurrently.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
@ 2006-07-16 20:08 Chuck Ebbert
2006-07-16 22:57 ` Jonathan Baccash
0 siblings, 1 reply; 10+ messages in thread
From: Chuck Ebbert @ 2006-07-16 20:08 UTC (permalink / raw)
To: Jonathan Baccash; +Cc: Ava Kivity, linux-kernel
In-Reply-To: <e0e4cb3e0607160938k70819e40g4172f5917045ebf8@mail.gmail.com>
On Sun, 16 Jul 2006 09:38:25 -0700, Jonathan Baccash wrote:
> > Each head has to service 1024 write requests (compared to just 512 read
> > requests).
>
> By that logic, it would take twice as long for my writes to finish.
> Why is it taking 4x as long in my parallel test?
Because a single read not only goes to just one disk, it is sent to
the disk with the lowest expected seek time for that request. This
cuts average read time in half, on average.
(See drivers/md/raid1.c::read_balance().)
> I would expect a raid-1 write
> to take about as long to write a single block as a single write to a
> single disk (assuming no other disk activity), because I would expect
> two writes to happen concurrently.
You didn't post any benchmarks showing results for single write to a
single disk.
--
Chuck
Think. Or you will be replaced with a small shell script. --dwmw2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
2006-07-16 20:08 Chuck Ebbert
@ 2006-07-16 22:57 ` Jonathan Baccash
0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Baccash @ 2006-07-16 22:57 UTC (permalink / raw)
To: Chuck Ebbert; +Cc: linux-kernel
> Because a single read not only goes to just one disk, it is sent to
> the disk with the lowest expected seek time for that request. This
> cuts average read time in half, on average.
>
> (See drivers/md/raid1.c::read_balance().)
Thanks Chuck! That is making some sense, although I think I'll have to
read and think about it some more before I quite understand.
> You didn't post any benchmarks showing results for single write to a
> single disk.
I didn't think I could get any repeatable results for a single write,
so I was trying to understand what is happening based on runs of
longer writes.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
2006-07-16 0:04 raid io requests not parallel? Jonathan Baccash
2006-07-16 1:07 ` Arjan van de Ven
2006-07-16 5:46 ` Avi Kivity
@ 2006-07-16 23:59 ` Neil Brown
2006-07-17 0:20 ` Jens Axboe
2 siblings, 1 reply; 10+ messages in thread
From: Neil Brown @ 2006-07-16 23:59 UTC (permalink / raw)
To: Jonathan Baccash; +Cc: linux-kernel
On Saturday July 15, jbaccash@gmail.com wrote:
> I'm using kernel linux-2.6.15-gentoo-r1, and I noticed performance of
> the software RAID-1 is not as good as I would have expected on my two
> SATA drives, and I was wondering if anyone has an idea what may be
> happening. The test I run is 1024 16k direct-IO reads/writes from
> random locations within a 1GB file (on a RAID-1 partition), with my
> disk caches set to
> write-through mode. In the MT (multi-threaded) case, I issue them from
> 8 threads (so it's 128 requests per thread):
>
> Random read: 10.295 sec
> Random write: 19.142 sec
Odd. I would expect these two numbers to be a lot closer together.
Try changing the IO scheduler on the drives and see if it makes a
difference.
e.g.
cat /sys/block/XXX/queue/scheduler
echo cfq > /sys/block/XXX/queue/scheduler
echo deadline > /sys/block/XXX/queue/scheduler
See what works best.
NeilBrown
> MT Random read: 5.276 sec
> MT Random write: 19.839 sec
>
> As expected, the multi-threaded reads are 2x as fast as single-threaded
> reads. But I would have expected (assuming the write to both disks can
> occur in parallel) that the random writes are about the same speed (10
> seconds) as the single-threaded random reads, for both the
> single-threaded and multi-threaded write cases. The fact that the
> multi-threaded reads were
> twice as fast indicates to me that read requests can occur in parallel.
>
> So.... why doesn't the raid issue the writes in parallel? Thanks in
> advance for any help.
>
> Jon.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: raid io requests not parallel?
2006-07-16 23:59 ` Neil Brown
@ 2006-07-17 0:20 ` Jens Axboe
0 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2006-07-17 0:20 UTC (permalink / raw)
To: Neil Brown; +Cc: Jonathan Baccash, linux-kernel
On Mon, Jul 17 2006, Neil Brown wrote:
> On Saturday July 15, jbaccash@gmail.com wrote:
> > I'm using kernel linux-2.6.15-gentoo-r1, and I noticed performance of
> > the software RAID-1 is not as good as I would have expected on my two
> > SATA drives, and I was wondering if anyone has an idea what may be
> > happening. The test I run is 1024 16k direct-IO reads/writes from
> > random locations within a 1GB file (on a RAID-1 partition), with my
> > disk caches set to
> > write-through mode. In the MT (multi-threaded) case, I issue them from
> > 8 threads (so it's 128 requests per thread):
> >
> > Random read: 10.295 sec
> > Random write: 19.142 sec
>
> Odd. I would expect these two numbers to be a lot closer together.
>
> Try changing the IO scheduler on the drives and see if it makes a
> difference.
> e.g.
> cat /sys/block/XXX/queue/scheduler
> echo cfq > /sys/block/XXX/queue/scheduler
> echo deadline > /sys/block/XXX/queue/scheduler
>
> See what works best.
His cache is set to write through, 16kb direct writes in that case will
be a lot slower than the equivalent reads. 10 vs 20 seconds does not
sounds out of the question.
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-07-17 0:21 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-16 0:04 raid io requests not parallel? Jonathan Baccash
2006-07-16 1:07 ` Arjan van de Ven
2006-07-16 5:46 ` Avi Kivity
2006-07-16 16:38 ` Jonathan Baccash
2006-07-16 23:59 ` Neil Brown
2006-07-17 0:20 ` Jens Axboe
[not found] <fa.di4ao4hbHlmvf0KHMl+KieWzn2E@ifi.uio.no>
2006-07-16 1:41 ` Robert Hancock
-- strict thread matches above, loose matches on Subject: below --
2006-07-16 3:17 Chuck Ebbert
2006-07-16 20:08 Chuck Ebbert
2006-07-16 22:57 ` Jonathan Baccash
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox