* Speeding up rbd_stat() in libvirt
@ 2015-12-28 13:48 Wido den Hollander
2016-01-04 15:38 ` Jason Dillaman
0 siblings, 1 reply; 4+ messages in thread
From: Wido den Hollander @ 2015-12-28 13:48 UTC (permalink / raw)
To: ceph-devel@vger.kernel.org
Hi,
The storage pools of libvirt know a mechanism called 'refresh' which
will scan a storage pool to refresh the contents.
The current implementation does:
* List all images via rbd_list()
* Call rbd_stat() on each image
Source:
http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_rbd.c;h=cdbfdee98505492407669130712046783223c3cf;hb=master#l329
This works, but a RBD pool with 10k images takes a couple of minutes to
scan.
Now, Ceph is distributed, so this could be done in parallel, but before
I start on this I was wondering if somebody had a good idea to fix this?
I don't know if it is allowed in libvirt to spawn multiple threads and
have workers do this, but it was something which came to mind.
libvirt only wants to know the size of a image and this is now stored in
the rbd_directory object, so the rbd_stat() is required.
Suggestions or ideas? I would like to have this process to be as fast as
possible.
Wido
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Speeding up rbd_stat() in libvirt
2015-12-28 13:48 Speeding up rbd_stat() in libvirt Wido den Hollander
@ 2016-01-04 15:38 ` Jason Dillaman
2016-01-04 15:59 ` Wido den Hollander
2016-01-06 15:31 ` Wido den Hollander
0 siblings, 2 replies; 4+ messages in thread
From: Jason Dillaman @ 2016-01-04 15:38 UTC (permalink / raw)
To: Wido den Hollander; +Cc: ceph-devel
Short term, assuming there wouldn't be an objection from the libvirt community, I think spawning a thread pool and concurrently executing several rbd_stat calls concurrently would be the easiest and cleanest solution. I wouldn't suggest trying to roll your own solution for retrieving image sizes for format 1 and 2 RBD images directly within libvirt.
Longer term, given this use case, perhaps it would make sense to add an async version of rbd_open. The rbd_stat call itself just reads the data from memory initialized by rbd_open. On the Jewel branch, librbd has had some major rework and image loading is asynchronous under the hood already.
--
Jason Dillaman
----- Original Message -----
> From: "Wido den Hollander" <wido@42on.com>
> To: ceph-devel@vger.kernel.org
> Sent: Monday, December 28, 2015 8:48:40 AM
> Subject: Speeding up rbd_stat() in libvirt
>
> Hi,
>
> The storage pools of libvirt know a mechanism called 'refresh' which
> will scan a storage pool to refresh the contents.
>
> The current implementation does:
> * List all images via rbd_list()
> * Call rbd_stat() on each image
>
> Source:
> http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_rbd.c;h=cdbfdee98505492407669130712046783223c3cf;hb=master#l329
>
> This works, but a RBD pool with 10k images takes a couple of minutes to
> scan.
>
> Now, Ceph is distributed, so this could be done in parallel, but before
> I start on this I was wondering if somebody had a good idea to fix this?
>
> I don't know if it is allowed in libvirt to spawn multiple threads and
> have workers do this, but it was something which came to mind.
>
> libvirt only wants to know the size of a image and this is now stored in
> the rbd_directory object, so the rbd_stat() is required.
>
> Suggestions or ideas? I would like to have this process to be as fast as
> possible.
>
> Wido
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Speeding up rbd_stat() in libvirt
2016-01-04 15:38 ` Jason Dillaman
@ 2016-01-04 15:59 ` Wido den Hollander
2016-01-06 15:31 ` Wido den Hollander
1 sibling, 0 replies; 4+ messages in thread
From: Wido den Hollander @ 2016-01-04 15:59 UTC (permalink / raw)
To: Jason Dillaman; +Cc: ceph-devel
On 04-01-16 16:38, Jason Dillaman wrote:
> Short term, assuming there wouldn't be an objection from the libvirt community, I think spawning a thread pool and concurrently executing several rbd_stat calls concurrently would be the easiest and cleanest solution. I wouldn't suggest trying to roll your own solution for retrieving image sizes for format 1 and 2 RBD images directly within libvirt.
>
I'll ask in the libvirt community if they allow such a thing.
> Longer term, given this use case, perhaps it would make sense to add an async version of rbd_open. The rbd_stat call itself just reads the data from memory initialized by rbd_open. On the Jewel branch, librbd has had some major rework and image loading is asynchronous under the hood already.
>
Hmm, that would be nice. In the callback I could call rbd_stat() and
populate the volume list within libvirt.
I would very much like to go that route since it saves me a lot of code
inside libvirt ;)
Wido
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Speeding up rbd_stat() in libvirt
2016-01-04 15:38 ` Jason Dillaman
2016-01-04 15:59 ` Wido den Hollander
@ 2016-01-06 15:31 ` Wido den Hollander
1 sibling, 0 replies; 4+ messages in thread
From: Wido den Hollander @ 2016-01-06 15:31 UTC (permalink / raw)
To: Jason Dillaman; +Cc: ceph-devel
On 04-01-16 16:38, Jason Dillaman wrote:
> Short term, assuming there wouldn't be an objection from the libvirt community, I think spawning a thread pool and concurrently executing several rbd_stat calls concurrently would be the easiest and cleanest solution. I wouldn't suggest trying to roll your own solution for retrieving image sizes for format 1 and 2 RBD images directly within libvirt.
>
> Longer term, given this use case, perhaps it would make sense to add an async version of rbd_open. The rbd_stat call itself just reads the data from memory initialized by rbd_open. On the Jewel branch, librbd has had some major rework and image loading is asynchronous under the hood already.
>
I created a issue for this: http://tracker.ceph.com/issues/14264
Would be nice to have in librbd.
Wido
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-06 15:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-28 13:48 Speeding up rbd_stat() in libvirt Wido den Hollander
2016-01-04 15:38 ` Jason Dillaman
2016-01-04 15:59 ` Wido den Hollander
2016-01-06 15:31 ` Wido den Hollander
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.