jeremy avnet
2010-Mar-31 17:32 UTC
[libvirt-users] advice on creating and reusing connections
Are there any recommendations as to how often a new connection should be made versus reused? Right now we create a new connection *every time* we hit libvirt for something. We can easily change this so that a single connection is made for a series of libvirt calls, or even so that a single connection is used for the lifetime of the running application. What are the issues to consider when making these choices? We are connecting to qemu:///system. Thank you. .:. brainsik -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20100331/e56baa2b/attachment.htm>
Daniel Veillard
2010-Mar-31 20:21 UTC
[libvirt-users] advice on creating and reusing connections
On Wed, Mar 31, 2010 at 10:32:13AM -0700, jeremy avnet wrote:> Are there any recommendations as to how often a new connection should be > made versus reused? Right now we create a new connection *every time* we hit > libvirt for something. We can easily change this so that a single connection > is made for a series of libvirt calls, or even so that a single connection > is used for the lifetime of the running application. > > What are the issues to consider when making these choices?libvirt API used to be not thread safe, so for concurrent or GUI related it was often a good idea to at least have one connection per thread. Those days it's not really needed. Note that most operations in libvirt are synchronous, and a few are rather long running so it's tempting to have concurrent operations in different threads. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/