[Libvir] Scability / performance fix for virDomainLookupByID
Daniel P. Berrange
berrange at redhat.com
Fri Jul 7 15:55:49 UTC 2006
On Fri, Jul 07, 2006 at 11:46:08AM -0400, Daniel Veillard wrote:
> On Fri, Jul 07, 2006 at 03:47:59PM +0100, Daniel P. Berrange wrote:
> > Attached is a patch to significantly increase scalability / performance of
> > the xenDaemonLookupByID method. The current implementation would get a
> > list of all domain names from XenD, and then iterate doing a HTTP GET on
> > /xend/domain/[name] until the domain with match ID was found. THis had
> > O(n) complexity, with the result that when running on a system with 20
> > actives domains, 'virsh list' would have O(n^2) complexity needing ~230
> > HTTP calls, giving a runtime of ~9 seconds.
> > The patch is to make the code do a HTTP GET on /xend/domain/[id] which we
> > just discovered is a valid URL to access. This makes the method call O(1),
> I should have guessed that earlier, especially after the report
> last week about virDomainLookupByName(conn, "1") working fine ...
> > and 'virsh list' is now a saner O(n), and completes in ~1 second. While
> > still not great performance, this is certainly much better. I think it
> > ought to be possible to optimize the code still further so that XenD is
> > avoided altogether for simple commands which can be fullfilled purely
> > with data available from Hypervisor, but that will need further
> > investigation.
> > Please review the patch in case I missed any bugs / edge cases
> just 2 small things:
> in xenDaemonLookupByID, it seems (but I may have misread the patch)
> that the free of name in the error code in case the rpc failed is a bit
> risky and should be guarded by if (name != NULL)
Yep, good catch - I missed that check.
> and the documentation for the new function in xend_internal.h is the old
> one inherited from Anthony first version, I somehow deprecated it, documenting
> the function itself in the .c file, but it's just nitpicking :-)
Ok, since its all duplicated in the .c file, shall we just rip out all the
docs from the xend_internal.h files ?
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
More information about the libvir-list