← Back to team overview

openstack team mailing list archive

Re: eventlet weirdness

 

It could be over-complicated (ie an example), but its a design that lets the program think in what tasks need to be accomplished and how to order those tasks and not have to think about how those tasks are actually ran (or hopefully even what concurrency occurs). Ideally there should be no concurrency in each step, that's the whole point of having individual steps :-) A step itself shouldn't be concurrent, but the overall  "action" should/could be and you leave it up to the "engine" to decide how to run those set of steps. *Just my thought*...

On 3/2/12 11:38 AM, "Day, Phil" <philip.day@xxxxxx> wrote:

That sounds a bit over complicated to me - Having a string of tasks sounds like you still have to think about what the concurrency is within each step.

There is already a good abstraction around the context of each operation - they just (I know - big just) need to be running in something that maps to kernel threads rather than user space ones.

All I really want to is to allow more than one action to run at the same time.  So if I have two requests to create a snapshot, why can't they both run at the same time and still allow other things to happen ?     I have all these cores sitting in my compute node that there that could be used, but I'm still having to think like a punch-card programmer submitting batch jobs to the mainframe ;-)

Right now creating snapshots is pretty close to a DoS attack on a compute node.



From: Joshua Harlow [mailto:harlowja@xxxxxxxxxxxxx]
Sent: 02 March 2012 19:23
To: Day, Phil; Chris Behrens
Cc: openstack
Subject: Re: [Openstack] eventlet weirdness

So a thought I had was that say if the design of a component forces as part of its design the ability to be ran with threads or with eventlet or with processes.

Say if u break everything up into tasks (where a task would produce some output/result/side-effect).
A set of tasks could complete some action (ie, create a vm).
Subtasks could be the following:
    0. Validate credentials
    1. Get the image
    2. Call into libvirt
    3. ...

These "tasks", if constructed in a way that makes them stateless, and then could be chained together to form an action, then that action could be given say to a threaded "engine" that would know how to execute those tasks with threads, or it could be given to an eventlet "engine" that would do the same with evenlet pool/greenthreads/coroutings, or with processes (and so on). This could be one way the design of your code abstracts that kind of execution (where eventlet is abstracted away from the actual work being done, instead of popping up in calls to sleep(0), ie the leaky abstraction).

On 3/2/12 11:08 AM, "Day, Phil" <philip.day@xxxxxx> wrote:
I didn't say it was pretty - Given the choice I'd much rather have a threading model that really did concurrency and pre-emption all the right places, and it would be really cool if something managed the threads that were started so that is a second conflicting request was received it did some proper tidy up or blocking rather than just leaving the race condition to work itself out (then we wouldn't have to try and control it by checking vm_state).

However ...   In the current code base where we only have user space based eventlets, with no pre-emption, and some activities that need to be prioritised then forcing pre-emption with a sleep(0) seems a pretty small bit of untidy.   And it works now without a major code refactor.

Always open to other approaches ...

Phil


-----Original Message-----
From: openstack-bounces+philip.day=hp.com@xxxxxxxxxxxxxxxxxxx [mailto:openstack-bounces+philip.day=hp.com@xxxxxxxxxxxxxxxxxxx] On Behalf Of Chris Behrens
Sent: 02 March 2012 19:00
To: Joshua Harlow
Cc: openstack; Chris Behrens
Subject: Re: [Openstack] eventlet weirdness

It's not just you


On Mar 2, 2012, at 10:35 AM, Joshua Harlow wrote:

> 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@xxxxxxxxxxxxx> 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@xxxxxxxxx]
> > Sent: 02 March 2012 16:22
> > To: Armando Migliaccio
> > Cc: openstack@xxxxxxxxxxxxxxxxxxx
> > 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@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp


_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to     : openstack@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


References