[Openstack] eventlet weirdness

Eric Windisch eric at cloudscaling.com
Fri Mar 2 19:04:22 UTC 2012


The problem is that unless you sleep(0), eventlet only switches context when you hit a file descriptor.  

As long as python coroutines are used, we should put sleep(0) where-ever it is expected that there will be a long-running loop where file descriptors are not touched. As noted elsewhere in this thread, MySQL file descriptors don't count, they're not coroutine friendly.

The premise is that cpus are pretty fast and get quickly from one call of a file descriptor to another, that the blocking of these descriptors is what a CPU most waits on, and this is an easy and obvious place to switch coroutines via monkey-patching.

That said, it shouldn't be necessary to "sprinkle" sleep(0) calls. They should be strategically placed, as necessary.

"race-conditions" around coroutine switching sounds more like thread-safety issues...  

--  
Eric Windisch


On Friday, March 2, 2012 at 1:35 PM, Joshua Harlow wrote:

> Re: [Openstack] eventlet weirdness Does anyone else feel that the following seems really “dirty”, or is it just me.
>  
> “adding a few sleep(0) calls in various places in the
> Nova codebase (as was recently added in the _sync_power_states()
> periodic task) is an easy and simple win with pretty much no ill
> side-effects. :)”
>  
> Dirty in that it feels like there is something wrong from a design point of view.
> Sprinkling “sleep(0)” seems like its a band-aid on a larger problem imho.  
> But that’s just my gut feeling.
>  
> :-(
>  
> On 3/2/12 8:26 AM, "Armando Migliaccio" <Armando.Migliaccio at eu.citrix.com> wrote:
>  
> > I knew you'd say that :P
> >  
> > There you go: https://bugs.launchpad.net/nova/+bug/944145
> >  
> > Cheers,
> > Armando
> >  
> > > -----Original Message-----
> > > From: Jay Pipes [mailto:jaypipes at gmail.com]
> > > Sent: 02 March 2012 16:22
> > > To: Armando Migliaccio
> > > Cc: openstack at lists.launchpad.net
> > > Subject: Re: [Openstack] eventlet weirdness
> > >  
> > > On 03/02/2012 10:52 AM, Armando Migliaccio wrote:
> > > > I'd be cautious to say that no ill side-effects were introduced. I found a
> > >  
> > > race condition right in the middle of sync_power_states, which I assume was
> > > exposed by "breaking" the task deliberately.
> > >  
> > > Such a party-pooper! ;)
> > >  
> > > Got a link to the bug report for me?
> > >  
> > > Thanks!
> > > -jay
> >  
> >  
> > _______________________________________________
> > Mailing list: https://launchpad.net/~openstack
> > Post to : openstack at lists.launchpad.net
> > Unsubscribe : https://launchpad.net/~openstack
> > More help : https://help.launchpad.net/ListHelp
>  
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to : openstack at lists.launchpad.net (mailto:openstack at lists.launchpad.net)
> Unsubscribe : https://launchpad.net/~openstack
> More help : https://help.launchpad.net/ListHelp







More information about the Openstack mailing list