Kernel RBD Readahead
Quoted 12 lines · Nick Fisk
Hi Ilya,
I was wondering if I could just get your thoughts on a matter I have run into?
Its surrounding read performance of the RBD kernel client and blk-mq, mainly when doing large single threaded reads. During testing performance seems to be limited to around 40MB/s, which is probably fairly similar to what you would expect to get from a single OSD. This is to be expected as an RBD is just a long chain of objects each on a different OSD which is being read through in order one at a time.
Quoted 6 lines
In theory readahead should make up for this by making the RBD client read from several OSD’s ahead of the current required block. However from what I can see it seems that setting a readahead value higher than
max_sectors_kbdoesn’t appear to have any effect, meaning that readahead is limited to each object that is currently being read. Would you be able to confirm if this is correct and if this is by design?
[CCing ceph-devel]
Certainly not by design. rbd is just a block device driver, so if the kernel submits a readahead read, it will obey and carry it out in full. The readahead is driven by the VM in pages, it doesn't care about rbd object boundaries and such.
That said, one problem is in the VM subsystem, where readaheads get capped at 512 pages (= 2M). If you do a simple single threaded read test, you'll see 4096 sector (= 2M) I/Os instead of object size I/Os:
$ rbd info foo | grep order
order 24 (16384 kB objects)
$ blockdev --getra /dev/rbd0
32768
$ dd if=/dev/rbd0 of=/dev/null bs=32M
# avgrq-sz is 4096.00This was introduced in commit 6d2be915e589 ("mm/readahead.c: fix readahead failure for memoryless NUMA nodes and limit readahead pages") [1], which went into 3.15. The hard limit was Linus' suggestion, apparently.
#define MAX_READAHEAD ((512*4096)/PAGE_CACHE_SIZE)
/*
* Given a desired number of PAGE_CACHE_SIZE readahead pages, return a
* sensible upper limit.
*/
unsigned long max_sane_readahead(unsigned long nr)
{
return min(nr, MAX_READAHEAD);
}This limit used to be dynamic and depended on the number of free pages in the system. There has been an attempt to bring that behaviour back [2], but it didn't go very far as far as getting into mainline. It looks like Red Hat and Oracle are shipping [2] in some of their kernels though. If you apply it, you'll see 32768 sector (= 16M) I/Os in the above test, which is how it should be.
[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6d2be915e589b58cb11418cbe1f22ff90732b6ac
[2] http://thread.gmane.org/gmane.linux.kernel/1893680
One thing we should be doing is setting read_ahead_kb to object size, the default 128k doesn't really cut it for rbd. I'll send a patch for that.
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 83 lines · Nick Fisk
Quoted 69 lines
-----Original Message-----
From: Ilya Dryomov [mailto:[email protected]]
Sent: 23 August 2015 18:33
To: Nick Fisk <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: Kernel RBD ReadaheadQuoted 12 lines · Nick Fisk
Hi Ilya,
I was wondering if I could just get your thoughts on a matter I have run into?
Its surrounding read performance of the RBD kernel client and blk-mq, mainly when doing large single threaded reads. During testing performance seems to be limited to around 40MB/s, which is probably fairly similar to what you would expect to get from a single OSD. This is to be expected as an RBD is just a long chain of objects each on a different OSD which is being read through in order one at a time.
Quoted 6 lines
In theory readahead should make up for this by making the RBD client read from several OSD’s ahead of the current required block. However from what I can see it seems that setting a readahead value higher than
max_sectors_kbdoesn’t appear to have any effect, meaning that readahead is limited to each object that is currently being read. Would you be able to confirm if this is correct and if this is by design?[CCing ceph-devel]
Certainly not by design. rbd is just a block device driver, so if the kernel submits a readahead read, it will obey and carry it out in full. The readahead is driven by the VM in pages, it doesn't care about rbd object boundaries and such.
That said, one problem is in the VM subsystem, where readaheads get capped at 512 pages (= 2M). If you do a simple single threaded read test, you'll see 4096 sector (= 2M) I/Os instead of object size I/Os:
$ rbd info foo | grep order order 24 (16384 kB objects) $ blockdev --getra /dev/rbd0 32768 $ dd if=/dev/rbd0 of=/dev/null bs=32M # avgrq-sz is 4096.00This was introduced in commit
6d2be915e589("mm/readahead.c: fix readahead failure for memoryless NUMA nodes and limit readahead pages") [1], which went into 3.15. The hard limit was Linus' suggestion, apparently.#define
MAX_READAHEAD((512*4096)/PAGE_CACHE_SIZE)
/*
* Given a desired number ofPAGE_CACHE_SIZEreadahead pages, return a
* sensible upper limit.
*/unsigned long max_sane_readahead(unsigned long nr) { return min(nr, MAX_READAHEAD); }This limit used to be dynamic and depended on the number of free pages in the system. There has been an attempt to bring that behaviour back [2], but it didn't go very far as far as getting into mainline. It looks like Red Hat and Oracle are shipping [2] in some of their kernels though. If you apply it, you'll see 32768 sector (= 16M) I/Os in the above test, which is how it should be.
[1]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6d2be915e589b58cb11418cbe1f22ff90732b6ac
[2] http://thread.gmane.org/gmane.linux.kernel/1893680Quoted 6 lines
One thing we should be doing is setting
read_ahead_kbto object size, the default 128k doesn't really cut it for rbd. I'll send a patch for that.Thanks,
Ilya
Thanks for your response.
I do see the IO's being limited to 4096 sectors in the 4.1 kernel and so that is likely to be partly the cause of the poor performance I am seeing. However I tried a 3.14 kernel and saw the same level performance, but this time the IO's were limited to 1024 sectors. The queue depth was at around 8 so I guess this means its submitting 8*512kb IO's up to the
max_sectors_kblimit of 4096KB. From the OSD point of view, this will still be accessing 1 OSD at a time.Maybe I'm expecting the wrong results but I was expecting that either 1 of these 2 scenarios would happen.
Quoted 7 lines
1. Kernel submits a large enough IO to satisfy the readahead value,
max_sectors_kbwould need to be higher than the object size (currently not possible) and the RADOS layer would be responsible for doing the parallel reads to the OSD's to satisfy it.2. Kernel recognises that the readahead is bigger than the
max_sectors_kbvalue and submits several IO's in parallel to the RBD device to satisfy the readahead request. Ie 32MB readahead would submit 8x4MB IO's in parallel.Please let me know if I have got the wrong idea here. But in my head either solution should improve sequential reads by a large amount, with the 2nd possibly slightly better as you are only waiting on the 1st OSD to respond to complete the request.
Thanks for including the Ceph-Devel list, unfortunately despite several attempts I have not been able to post to this list after subscribing, please can you forward any correspondence if you think it would be useful to share.
Did you remember to set max_sectors_kb to max_hw_sectors_kb? The block layer in 3.14 leaves max_sectors_kb at 512, even when max_hw_sectors_kb is set to a much bigger value by the driver. If you adjust it, you should be able to see object size requests, at least sometimes. Note that you definitely won't see them all the time due to max_segments limitation, which was lifted only recently.
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 90 lines · Ilya Dryomov
Quoted 89 lines · Nick Fisk
Quoted 69 lines
-----Original Message-----
From: Ilya Dryomov [mailto:[email protected]]
Sent: 23 August 2015 18:33
To: Nick Fisk <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: Kernel RBD ReadaheadQuoted 12 lines · Nick Fisk
Hi Ilya,
I was wondering if I could just get your thoughts on a matter I have run into?
Its surrounding read performance of the RBD kernel client and blk-mq, mainly when doing large single threaded reads. During testing performance seems to be limited to around 40MB/s, which is probably fairly similar to what you would expect to get from a single OSD. This is to be expected as an RBD is just a long chain of objects each on a different OSD which is being read through in order one at a time.
Quoted 6 lines
In theory readahead should make up for this by making the RBD client read from several OSD’s ahead of the current required block. However from what I can see it seems that setting a readahead value higher than
max_sectors_kbdoesn’t appear to have any effect, meaning that readahead is limited to each object that is currently being read. Would you be able to confirm if this is correct and if this is by design?[CCing ceph-devel]
Certainly not by design. rbd is just a block device driver, so if the kernel submits a readahead read, it will obey and carry it out in full. The readahead is driven by the VM in pages, it doesn't care about rbd object boundaries and such.
That said, one problem is in the VM subsystem, where readaheads get capped at 512 pages (= 2M). If you do a simple single threaded read test, you'll see 4096 sector (= 2M) I/Os instead of object size I/Os:
$ rbd info foo | grep order order 24 (16384 kB objects) $ blockdev --getra /dev/rbd0 32768 $ dd if=/dev/rbd0 of=/dev/null bs=32M # avgrq-sz is 4096.00This was introduced in commit
6d2be915e589("mm/readahead.c: fix readahead failure for memoryless NUMA nodes and limit readahead pages") [1], which went into 3.15. The hard limit was Linus' suggestion, apparently.#define
MAX_READAHEAD((512*4096)/PAGE_CACHE_SIZE)
/*
* Given a desired number ofPAGE_CACHE_SIZEreadahead pages, return a
* sensible upper limit.
*/unsigned long max_sane_readahead(unsigned long nr) { return min(nr, MAX_READAHEAD); }This limit used to be dynamic and depended on the number of free pages in the system. There has been an attempt to bring that behaviour back [2], but it didn't go very far as far as getting into mainline. It looks like Red Hat and Oracle are shipping [2] in some of their kernels though. If you apply it, you'll see 32768 sector (= 16M) I/Os in the above test, which is how it should be.
[1]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6d2be915e589b58cb11418cbe1f22ff90732b6ac
[2] http://thread.gmane.org/gmane.linux.kernel/1893680Quoted 6 lines
One thing we should be doing is setting
read_ahead_kbto object size, the default 128k doesn't really cut it for rbd. I'll send a patch for that.Thanks,
Ilya
Thanks for your response.
I do see the IO's being limited to 4096 sectors in the 4.1 kernel and so that is likely to be partly the cause of the poor performance I am seeing. However I tried a 3.14 kernel and saw the same level performance, but this time the IO's were limited to 1024 sectors. The queue depth was at around 8 so I guess this means its submitting 8*512kb IO's up to the
max_sectors_kblimit of 4096KB. From the OSD point of view, this will still be accessing 1 OSD at a time.Maybe I'm expecting the wrong results but I was expecting that either 1 of these 2 scenarios would happen.
1. Kernel submits a large enough IO to satisfy the readahead value,
max_sectors_kbwould need to be higher than the object size (currently not possible) and the RADOS layer would be responsible for doing the parallel reads to the OSD's to satisfy it.2. Kernel recognises that the readahead is bigger than the
max_sectors_kbvalue and submits several IO's in parallel to the RBD device to satisfy the readahead request. Ie 32MB readahead would submit 8x4MB IO's in parallel.Please let me know if I have got the wrong idea here. But in my head either solution should improve sequential reads by a large amount, with the 2nd possibly slightly better as you are only waiting on the 1st OSD to respond to complete the request.
Quoted 8 lines
Quoted 1 line
Thanks for including the Ceph-Devel list, unfortunately despite several attempts I have not been able to post to this list after subscribing, please can you forward any correspondence if you think it would be useful to share.
Did you remember to set
max_sectors_kbtomax_hw_sectors_kb? The block layer in 3.14 leavesmax_sectors_kbat 512, even whenmax_hw_sectors_kbis set to a much bigger value by the driver. If you adjust it, you should be able to see object size requests, at least sometimes. Note that you definitely won't see them all the time due tomax_segmentslimitation, which was lifted only recently.
I just realized that what I wrote is true for O_DIRECT reads. For page cache driven reads, which is what we are discussing, the max_segments limitation is killer - 128 pages = 512k. The fix was a one-liner, but I don't think it was submitted for stable.
The other thing is that 3.14.21+ kernels are just as screwed readahead wise as 3.15+, as the offending commit was backported. So even if I submit the max_segments one-liner to stable and it makes it to say 3.14.52, we will still get only 4096 sector page cache I/Os, just like you got on 4.1.
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 149 lines · Nick Fisk
Quoted 116 lines
-----Original Message-----
From: Ilya Dryomov [mailto:[email protected]]
Sent: 24 August 2015 16:07
To: Nick Fisk <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: Kernel RBD ReadaheadQuoted 14 lines · Ilya Dryomov
Quoted 13 lines · Nick Fisk
Quoted 13 lines
-----Original Message-----
From: Ilya Dryomov [mailto:[email protected]]
Sent: 23 August 2015 18:33
To: Nick Fisk <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: Kernel RBD ReadaheadQuoted 5 lines · Nick Fisk
Hi Ilya,
I was wondering if I could just get your thoughts on a matter I have run into?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Its surrounding read performance of the RBD kernel client and blk-mq, mainly when doing large single threaded reads. During testing performance seems to be limited to around 40MB/s, which is probably fairly similar to what you would expect to get from a single OSD. This is to be expected as an RBD is just a long chain of objects each on a different OSD which is being read through in order
one at a time.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
In theory readahead should make up for this by making the RBD client read from several OSD’s ahead of the current required block. However from what I can see it seems that setting a readahead value higher than
max_sectors_kbdoesn’t appear to have any effect, meaning that readahead is limited to each object that iscurrently being read.
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 1 line
Would you be able to confirm if this is correct and if this is by design?
[CCing ceph-devel]
Certainly not by design. rbd is just a block device driver, so if the kernel submits a readahead read, it will obey and carry it out in full. The readahead is driven by the VM in pages, it doesn't care about rbd object boundaries and such.
That said, one problem is in the VM subsystem, where readaheads get capped at 512 pages (= 2M). If you do a simple single threaded read test, you'll see 4096 sector (= 2M) I/Os instead of object size I/Os:
$ rbd info foo | grep order order 24 (16384 kB objects) $ blockdev --getra /dev/rbd0 32768 $ dd if=/dev/rbd0 of=/dev/null bs=32M # avgrq-sz is 4096.00Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
This was introduced in commit
6d2be915e589("mm/readahead.c: fix readahead failure for memoryless NUMA nodes and limit readahead pages") [1], which went into 3.15. The hard limit was Linus' suggestion,apparently.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
#define
MAX_READAHEAD((512*4096)/PAGE_CACHE_SIZE)
/*
* Given a desired number ofPAGE_CACHE_SIZEreadahead pages,return
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
a
* sensible upper limit.
*/unsigned long max_sane_readahead(unsigned long nr) { return min(nr, MAX_READAHEAD); }This limit used to be dynamic and depended on the number of free pages in the system. There has been an attempt to bring that behaviour back [2], but it didn't go very far as far as getting into mainline. It looks like Red Hat and Oracle are shipping [2] in some of their kernels though. If you apply it, you'll see 32768 sector (= 16M)
I/Os in the above test, which is how it should be.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
[1]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm
it/?id=6d2be915e589b58cb11418cbe1f22ff90732b6ac
[2] http://thread.gmane.org/gmane.linux.kernel/1893680One thing we should be doing is setting
read_ahead_kbto object size, the default 128k doesn't really cut it for rbd. I'll send a patch forthat.
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Thanks,
Ilya
Thanks for your response.
I do see the IO's being limited to 4096 sectors in the 4.1 kernel and so that
is likely to be partly the cause of the poor performance I am seeing. However I tried a 3.14 kernel and saw the same level performance, but this time the IO's were limited to 1024 sectors. The queue depth was at around 8 so I guess this means its submitting 8*512kb IO's up to the
max_sectors_kblimit of 4096KB. From the OSD point of view, this will still be accessing 1 OSD at a time.Quoted 2 lines
Quoted 2 lines
Maybe I'm expecting the wrong results but I was expecting that either 1
of these 2 scenarios would happen.
Quoted 2 lines
Quoted 2 lines
1. Kernel submits a large enough IO to satisfy the readahead value,
max_sectors_kbwould need to be higher than the object size (currently not possible) and the RADOS layer would be responsible for doing the parallel reads to the OSD's to satisfy it.Quoted 2 lines
Quoted 2 lines
2. Kernel recognises that the readahead is bigger than the
max_sectors_kbvalue and submits several IO's in parallel to the RBD device to satisfy the readahead request. Ie 32MB readahead would submit 8x4MB IO's in parallel.Quoted 1 line
Quoted 1 line
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Please let me know if I have got the wrong idea here. But in my head
either solution should improve sequential reads by a large amount, with the 2nd possibly slightly better as you are only waiting on the 1st OSD to respond to complete the request.
Quoted 2 lines
Quoted 2 lines
Thanks for including the Ceph-Devel list, unfortunately despite several
attempts I have not been able to post to this list after subscribing, please can you forward any correspondence if you think it would be useful to share.
Quoted 7 lines
Did you remember to set
max_sectors_kbtomax_hw_sectors_kb? The block layer in 3.14 leavesmax_sectors_kbat 512, even whenmax_hw_sectors_kbis set to a much bigger value by the driver. If you adjust it, you should be able to see object size requests, at least sometimes. Note that you definitely won't see them all the time due tomax_segmentslimitation, which was lifted only recently.Yes I made sure I have checked this on all Kernels I have tested.
Quoted 5 lines
I just realized that what I wrote is true for
O_DIRECTreads. For page cache driven reads, which is what we are discussing, themax_segmentslimitation is killer - 128 pages = 512k. The fix was a one-liner, but I don't think it was submitted for stable.I'm also seeing this, which is probably not helping, but see below :-)
Quoted 6 lines
The other thing is that 3.14.21+ kernels are just as screwed readahead wise as 3.15+, as the offending commit was backported. So even if I submit the
max_segmentsone-liner to stable and it makes it to say 3.14.52, we will still get only 4096 sector page cache I/Os, just like you got on 4.1.
Quoted 7 lines
Yes, this was the problem, apologies I should have checked to see if the patch was back ported. I tried an older 3.14 release and I am now seeing up to 200MB/s, a massive improvement. Queue depths are hovering around the 50 mark which is what I would expect. I suspect with the
max_segmentsfix it would possibly go faster as the requests to the OSD would be larger.In that thread you linked, Linus asked for a real work example where that commit was causing problems, here is one.
"Using a Ceph RBD as a staging area before trying to stream to tape, which needs to average around 150-200MB/s to be suitable"
Where do we go from here to try and get the behaviour modified upstream?
Can you describe your use case in more detail, in a cut & pasteable way?
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 189 lines · Nick Fisk
Quoted 189 lines
-----Original Message-----
From: Ilya Dryomov [mailto:[email protected]]
Sent: 24 August 2015 18:19
To: Nick Fisk <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: Kernel RBD ReadaheadQuoted 32 lines · Nick Fisk
Quoted 32 lines
-----Original Message-----
From: Ilya Dryomov [mailto:[email protected]]
Sent: 24 August 2015 16:07
To: Nick Fisk <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: Kernel RBD ReadaheadQuoted 14 lines · Ilya Dryomov
Quoted 13 lines · Nick Fisk
Quoted 13 lines
-----Original Message-----
From: Ilya Dryomov [mailto:[email protected]]
Sent: 23 August 2015 18:33
To: Nick Fisk <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: Kernel RBD ReadaheadQuoted 5 lines · Nick Fisk
Hi Ilya,
I was wondering if I could just get your thoughts on a matter I have run into?
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Its surrounding read performance of the RBD kernel client and blk-mq, mainly when doing large single threaded reads. During testing performance seems to be limited to around 40MB/s, which is probably fairly similar to what you would expect to get from a single OSD. This is to be expected as an RBD is just a long chain of objects each on a different OSD which is being read through in order
one at a time.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
In theory readahead should make up for this by making the RBD client read from several OSD’s ahead of the current required block. However from what I can see it seems that setting a readahead value higher than
max_sectors_kbdoesn’t appear to have any effect, meaning that readahead is limited to each object that iscurrently being read.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Would you be able to confirm if this is correct and if this is by
design?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
[CCing ceph-devel]
Certainly not by design. rbd is just a block device driver, so if the kernel submits a readahead read, it will obey and carry it out in
full.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The readahead is driven by the VM in pages, it doesn't care about rbd object boundaries and such.
That said, one problem is in the VM subsystem, where readaheads get capped at 512 pages (= 2M). If you do a simple single threaded read test, you'll see 4096 sector (= 2M) I/Os instead of
object size I/Os:
Quoted 76 lines
Quoted 76 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
$ rbd info foo | grep order order 24 (16384 kB objects) $ blockdev --getra /dev/rbd0 32768 $ dd if=/dev/rbd0 of=/dev/null bs=32M # avgrq-sz is 4096.00Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
This was introduced in commit
6d2be915e589("mm/readahead.c: fix readahead failure for memoryless NUMA nodes and limit readahead pages") [1], which went into 3.15. The hard limit was Linus' suggestion,apparently.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
#define
MAX_READAHEAD((512*4096)/PAGE_CACHE_SIZE)
/*
* Given a desired number ofPAGE_CACHE_SIZEreadahead pages,return
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
a
* sensible upper limit.
*/unsigned long max_sane_readahead(unsigned long nr) { return min(nr, MAX_READAHEAD); }Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
This limit used to be dynamic and depended on the number of free pages in the system. There has been an attempt to bring that behaviour back [2], but it didn't go very far as far as getting into mainline. It looks like Red Hat and Oracle are shipping [2] in some of their kernels though. If you apply it, you'll see 32768 sector (= 16M)
I/Os in the above test, which is how it should be.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
[1]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/c
omm it/?id=6d2be915e589b58cb11418cbe1f22ff90732b6ac
[2] http://thread.gmane.org/gmane.linux.kernel/1893680One thing we should be doing is setting
read_ahead_kbto object size, the default 128k doesn't really cut it for rbd. I'll send a patch forthat.
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Thanks,
Ilya
Thanks for your response.
I do see the IO's being limited to 4096 sectors in the 4.1 kernel and so that
is likely to be partly the cause of the poor performance I am seeing. However I tried a 3.14 kernel and saw the same level performance, but this time the IO's were limited to 1024 sectors. The queue depth was at around 8 so I guess this means its submitting 8*512kb IO's up to the
max_sectors_kblimit of 4096KB. From the OSD point of view, this will still be accessing 1 OSD at a time.Quoted 3 lines
Quoted 3 lines
Maybe I'm expecting the wrong results but I was expecting that either 1
of these 2 scenarios would happen.
Quoted 3 lines
Quoted 3 lines
1. Kernel submits a large enough IO to satisfy the readahead value,
max_sectors_kbwould need to be higher than the object size (currently not
possible) and the RADOS layer would be responsible for doing the parallel reads to the OSD's to satisfy it.Quoted 2 lines
Quoted 2 lines
2. Kernel recognises that the readahead is bigger than the
max_sectors_kbvalue and submits several IO's in parallel to the RBD device to satisfy the readahead request. Ie 32MB readahead would submit 8x4MB IO's in parallel.Quoted 3 lines
Quoted 3 lines
Please let me know if I have got the wrong idea here. But in my head
Quoted 8 lines
Quoted 8 lines
either solution should improve sequential reads by a large amount, with the 2nd possibly slightly better as you are only waiting on the 1st OSD to respond to complete the request.
Quoted 3 lines
Quoted 3 lines
Thanks for including the Ceph-Devel list, unfortunately despite several
attempts I have not been able to post to this list after subscribing, please can you forward any correspondence if you think it would be
useful to share.
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
Did you remember to set
max_sectors_kbtomax_hw_sectors_kb? The block layer in 3.14 leavesmax_sectors_kbat 512, even whenmax_hw_sectors_kbis set to a much bigger value by the driver. If you adjust it, you should be able to see object size requests, at least sometimes. Note that you definitely won't see them all the time due tomax_segmentslimitation, which was lifted only recently.Yes I made sure I have checked this on all Kernels I have tested.
Quoted 1 line
Quoted 12 lines
Quoted 4 lines
I just realized that what I wrote is true for
O_DIRECTreads. For page cache driven reads, which is what we are discussing, themax_segmentslimitation is killer - 128 pages = 512k. The fix was a one-liner, but I don't think it was submitted for stable.I'm also seeing this, which is probably not helping, but see below :-)
Quoted 5 lines
The other thing is that 3.14.21+ kernels are just as screwed readahead wise as 3.15+, as the offending commit was backported. So even if I submit the
max_segmentsone-liner to stable and it makes it to say 3.14.52, we will still get only 4096 sector page cache I/Os, just likeyou got on 4.1.
Quoted 3 lines
Quoted 1 line
Yes, this was the problem, apologies I should have checked to see if the
patch was back ported. I tried an older 3.14 release and I am now seeing up to 200MB/s, a massive improvement. Queue depths are hovering around the 50 mark which is what I would expect. I suspect with the
max_segmentsfix it would possibly go faster as the requests to the OSD would be larger.Quoted 2 lines
In that thread you linked, Linus asked for a real work example where that
commit was causing problems, here is one.
Quoted 2 lines
"Using a Ceph RBD as a staging area before trying to stream to tape, which
needs to average around 150-200MB/s to be suitable"
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Where do we go from here to try and get the behaviour modified
upstream?
Can you describe your use case in more detail, in a cut & pasteable way?
Sure,
I'm using a Ceph kernel mounted RBD volume as a staging area for the Bacula backup software before writing the data to a FC connected LTO6 tape drive. The staging area is required as I cannot source data from the backup clients fast enough to satisfy the tape drive speed. The Tape drive requires a steady data input stream of around 160MB/s to be able to run smoothly at max speed. Using kernels with the pre-readhead limit I observe read speeds exceeding 200MB/s, after the readahead commit this speed drops to around 40MB/s. Backups are taking 4x as long as expected and I suspect tape+drive life may be reduced as the drive frequently buffer underruns and stop/starts.
So, before bringing this up on LKML, I wanted to get some more numbers, and thought about tests with md raid - it sets a custom (larger) reada window size to compensate for striping. It was only after I set it up that I stumbled upon [1]. This is another attempt at bringing us back, trigged by md raid performance regression. The patch gets rid of all NUMA node stuff altogether and Linus seems to be on board.
One question I have after looking at md is whether rbd should set reada window size to 1x object size or 2x object size. I'm inclined towards the former in order to not over do it, but I'd interested in numbers. Nick, since you have this beefy setup, can you share your results for 4M and 8M max_readahead_kb, assuming you are using default 4M object size?
[1] https://www.mail-archive.com/[email protected]/msg959637.html
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 25 lines · Nick Fisk
I have done two tests one with 1MB objects and another with 4MB objects, my cluster is a little busier than when I did the quick test yesterday, so all speeds are slightly down across the board but you can see the scaling effect nicely. Results:
1MB Order RBD
Readahead DD->Null Speed 128 18MB/s 1024 32MB/s 2048 40MB/s 4096 58MB/s 8192 75MB/s 16384 91MB/s 32768 160MB/s4MB Order RBD
128 42MB/s 1024 56MB/s 2048 61MB/s 4096 98MB/s 8192 121MB/s 16384 170MB/s 32768 195MB/s 65536 221MB/s 131072 271MB/sI think the results confirm my suspicions, where a full stripe in a raid array will usually only be a couple of MB (eg 256kb chunk * 8 disks) and so a relatively small readahead will involve all the disks for max performance. In a Ceph RBD a full stripe will be 4MB * number of OSD's in the cluster. So I think that if sequential read performance is the only goal, then readahead probably needs to equal that figure, which could be massive. But in reality like me you will probably find that you get sufficient performance at a lower value. Of course all this theory could all change when the kernel client gets striping support.
Quoted 8 lines
However in terms of a default, that’s a tricky one. Even setting it to 4096 would probably start to have a negative impact on pure random IO latency. Each read would make a OSD read a whole 4MB object, see small table below for IOP/Read size for disks in my cluster. I would imagine somewhere between 256-1024 would be a good trade off between where the OSD disks latency starts to rise. Users would need to be aware of their workload and tweak readahead if needed.
IOPs
(4k Random Read) 83 (64k Random Read) 81 (256k Random Read) 73 (1M Random Read) 52 (4M Random Read) 25
Yeah, we want a sensible default, but it's always going to be a trade off. librbd has readahead knobs, but the only real use case there is shortening qemu boot times, so we can't copy those settings. I'll have to think about it some more - it might make more sense to leave things as is. Users with large sequential read workloads should know to check and adjust readahead settings, and likely won't be satisfied with 1x object size anyway.
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 59 lines · Nick Fisk
Quoted 59 lines
-----Original Message-----
From: Ilya Dryomov [mailto:[email protected]]
Sent: 25 August 2015 09:45
To: Nick Fisk <[email protected]>
Cc: Ceph Development <[email protected]>
Subject: Re: Kernel RBD ReadaheadQuoted 1 line · Nick Fisk
I have done two tests one with 1MB objects and another with 4MB objects,
my cluster is a little busier than when I did the quick test yesterday, so all speeds are slightly down across the board but you can see the scaling effect nicely. Results:
Quoted 22 lines
1MB Order RBD
Readahead DD->Null Speed 128 18MB/s 1024 32MB/s 2048 40MB/s 4096 58MB/s 8192 75MB/s 16384 91MB/s 32768 160MB/s4MB Order RBD
128 42MB/s 1024 56MB/s 2048 61MB/s 4096 98MB/s 8192 121MB/s 16384 170MB/s 32768 195MB/s 65536 221MB/s 131072 271MB/sQuoted 1 line
I think the results confirm my suspicions, where a full stripe in a raid array
will usually only be a couple of MB (eg 256kb chunk * 8 disks) and so a relatively small readahead will involve all the disks for max performance. In a Ceph RBD a full stripe will be 4MB * number of OSD's in the cluster. So I think that if sequential read performance is the only goal, then readahead probably needs to equal that figure, which could be massive. But in reality like me you will probably find that you get sufficient performance at a lower value. Of course all this theory could all change when the kernel client gets striping support.
Quoted 2 lines
However in terms of a default, that’s a tricky one. Even setting it to 4096
would probably start to have a negative impact on pure random IO latency. Each read would make a OSD read a whole 4MB object, see small table below for IOP/Read size for disks in my cluster. I would imagine somewhere between 256-1024 would be a good trade off between where the OSD disks latency starts to rise. Users would need to be aware of their workload and tweak readahead if needed.
Quoted 7 lines
IOPs
(4k Random Read) 83 (64k Random Read) 81 (256k Random Read) 73 (1M Random Read) 52 (4M Random Read) 25
Quoted 8 lines
Quoted 6 lines
Yeah, we want a sensible default, but it's always going to be a trade off. librbd has readahead knobs, but the only real use case there is shortening qemu boot times, so we can't copy those settings. I'll have to think about it some more - it might make more sense to leave things as is. Users with large sequential read workloads should know to check and adjust readahead settings, and likely won't be satisfied with 1x object size anyway.
Ok. I might try and create a 4.1 kernel with the blk-mq queue depth/IO size + readahead +max_segments fixes in as I'm think the
TCP_NODELAYbug will still be present in my old 3.14 kernel.
I can build 4.2-rc8 + readahead patch on gitbuilders for you.
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Ilya Dryomov
Quoted 1 line
Ok. I might try and create a 4.1 kernel with the blk-mq queue
depth/IO size + readahead +max_segments fixes in as I'm think the
TCP_NODELAYbug will still be present in my old 3.14 kernel.I can build 4.2-rc8 + readahead patch on gitbuilders for you.
Hi,
are thoses patches available in 4.3 kernel ?
thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Olivier Bonvalet
Quoted 5 lines · Ilya Dryomov
Quoted 1 line
Ok. I might try and create a 4.1 kernel with the blk-mq queue
depth/IO size + readahead +max_segments fixes in as I'm think the
TCP_NODELAYbug will still be present in my old 3.14 kernel.I can build 4.2-rc8 + readahead patch on gitbuilders for you.
Hi,
are thoses patches available in 4.3 kernel ?
4.3 isn't released yet.
Everything but a readahead fix will be in 4.3. AFAICT readahead patch was picked up by Andrew for 4.4 [1] - the problem is not in rbd, so we have no direct control over it.
[1] http://comments.gmane.org/gmane.linux.kernel.commits.mm/96124
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 22 lines · Ilya Dryomov
Quoted 11 lines · Olivier Bonvalet
Quoted 5 lines · Ilya Dryomov
Quoted 1 line
Ok. I might try and create a 4.1 kernel with the blk-mq queue
depth/IO size + readahead +max_segments fixes in as I'm think the
TCP_NODELAYbug will still be present in my old 3.14 kernel.I can build 4.2-rc8 + readahead patch on gitbuilders for you.
Hi,
are thoses patches available in 4.3 kernel ?
4.3 isn't released yet.
Everything but a readahead fix will be in 4.3. AFAICT readahead patch
was picked up by Andrew for 4.4 [1] - the problem is not in rbd, so we
have no direct control over it.
Quoted 6 lines
[1] http://comments.gmane.org/gmane.linux.kernel.commits.mm/96124
Thanks,
Ilya
Great, thanks !
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html