[openstack-dev] [nova] threading in nova (greenthreads, OS threads, etc.)

Daniel P. Berrange berrange at redhat.com
Wed Jul 23 16:53:36 UTC 2014


On Wed, Jul 23, 2014 at 10:41:06AM -0600, Chris Friesen wrote:
> 
> Hi all,
> 
> I was wondering if someone could point me to a doc describing the threading
> model for nova.
> 
> I know that we use greenthreads to map multiple threads of execution onto a
> single native OS thread.  And the python GIL results in limitations as well.
> 
> According to the description at
> "https://bugs.launchpad.net/tripleo/+bug/1203906" for nova-api we
> potentially fork off multiple instances because it's database-heavy and we
> don't want to serialize on the database.
> 
> If that's the case, why do we only run one instance of nova-conductor on a
> single OS thread?
> 
> And looking at nova-compute on a compute node with no instances running I
> see 22 OS threads.  Where do these come from?  Are these related to libvirt?
> Or are they forked the way that nova-api is?

Since native C API calls block greenthreads, nova has a native thread pool
that is used for each libvirt API call. A similar thing is done for the
libguestfs API calls and optionally you can do it in the database driver
too. Basically any python module involving native C calls should be a
candidate for a native thread pool

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



More information about the OpenStack-dev mailing list