Giter VIP home page Giter VIP logo

Comments (9)

benoitc avatar benoitc commented on July 22, 2024

Maybe we could imagine a scale policy / show

policiy could be a list of conditionns:

"grow": { 
   "cpu": {"if": "> XX" # % of use, "while": "XX" # seconds}, 
   "ram": { "if": "> XX" # bytes } 
 }

And the same for shrink.

Then we could have a parameter named scale which could take the maximum number of workers you want to scale. This value and eventually the policy could be set dynamically too:

 circusctl scale <showname> 5
 circusctl set_policy <showname> grow.cpu.if "> 60%"

something like it. What do you think?

from circus.

tarekziade avatar tarekziade commented on July 22, 2024

so, are all these options at the Show class level ?

if so can you describe the new constructor interface.

For the configuration part I think we want two things:

  • being able to use the Show class programmatically - so the trainer needs to pass the options
  • define new options in the ini file -- so I think those are flat options

last, we need to define how this is going to work. I suspect the Show class needs a heartbeat thread that collects the cpu value of each Fly to decide whether to add or remove one.

from circus.

benoitc avatar benoitc commented on July 22, 2024

The constructor would have nothing special, this is just the show with
more options :

class Show(object):

    def __init__(self, name, cmd, num_flies=5, warmup_delay=1.,
                 working_dir=os.getcwd(), shell=False, uid=None,
                 gid=None, send_hup=False, scale=None, policy={}):
        ...

Configuration in an ini file (for those who are using it) :

[policy:showname]
cpu.if = ..
cpu.while = ...

I agree we need a way to check each flies info and eventually kill or
spawn them until the scale limit. I think it need to be done its own
thread or process whatever to make the work in parallel. We could either
launching a thread or if we want to be fancy a gevent process.

The trainer is passing to this circus director the ipc endpoint to
communicate with the controller. Each scale order (ttin, ttou) are sent
to the controller. First time the controller is launched it get the
shows config, if a show is scalable (scale is not None) then it get
flies info using the controller. then X mn like the trainer it will get
flies info & . On reload the show configuration is reloaded.

We also need to make sure that this director is alive which could be
handled by the trainer. In this case we need to know if the
thread/gevent process is still alive and not to busy.

If we are OK for this scenario I can provide an implementation soon.

from circus.

tarekziade avatar tarekziade commented on July 22, 2024

what's a director ? the thread that gets the process stats ? other than that the plan looks good to me

from circus.

benoitc avatar benoitc commented on July 22, 2024

yes I called it the director. Sounded good at this point...

from circus.

tarekziade avatar tarekziade commented on July 22, 2024

I wonder if we should not create the tests environment before adding new features. Things are getting hairy :)

from circus.

benoitc avatar benoitc commented on July 22, 2024

I the priority should be the security, then right we should add new features :)

from circus.

tarekziade avatar tarekziade commented on July 22, 2024

This should be done as a plugin.

from circus.

tarekziade avatar tarekziade commented on July 22, 2024

we don't seem to see the need for a generic auto-shrink/grow plugin at this point

from circus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.