Excellent!

> On Aug 25, 2017, at 10:46, Pau Freixes <[email protected]> wrote:
> 
> Thanks Saul,
> 
> Definitely this feature can be built on top of that PR, I'm just
> missing one statistic. I will jump to the PR to propose a small
> change.
> 
> 
> 
> On Fri, Aug 25, 2017 at 10:16 AM, Saúl Ibarra Corretgé <[email protected]> 
> wrote:
>> 
>>> On Aug 23, 2017, at 16:15, Pau Freixes <[email protected]> wrote:
>>> 
>>> Hi,
>>> 
>>> Im trying to push [1] for some changes in the CPython Asyncio core [1] to 
>>> publish a new method called load that would inform about how many resources 
>>> are used or how many of them are left. The idea behind this new method its 
>>> pretty easy and can be summarized as: A load of an asynchronous loop can be 
>>> at some point easily inferred using the sleeping time vs the overall time, 
>>> this information brings us to understand how to saturate is the loop with a 
>>> metric that informs you how many CPU resources are being used or most 
>>> important how many CPU resources left.
>>> 
>>> This metric can have many purposes, but the original idea was conceived to 
>>> allow the developer to apply some back pressure mechanisms at the 
>>> application layer. Having the info of how much resources you have or are 
>>> still pending to be used give you the chance to answer a key question: 
>>> could I face the ongoing request? The concept is not new and it's well 
>>> described in this blog posts [3] [4] , indeed there is an implementation in 
>>> NodeJS called `toobusy` that gets this metric implicitly using the lag of 
>>> the callbacks [5].
>>> 
>>> What I would like is continue with the work done and not finished - we will 
>>> see how it evolves - within the libuv. Having a new method called 
>>> `uv_loop_load` that will give you a float value between 0.0 and 1.0 that 
>>> will inform the user the load of the loop. The way to calculate this load 
>>> is based on the percentage of sleeping time vs the overall time, more info 
>>> about the algorithm here [6]
>>> 
>>> Before start on working with the code I would like to receive your 
>>> feedback, first impressions and if this change might be aligned with the 
>>> maintainers one
>>> 
>>> 
>>> [1] https://mail.python.org/pipermail/async-sig/2017-August/000382.html
>>> [2] 
>>> https://github.com/pfreixes/cpython/commit/ac07fef5af51746c7311494f21b0f067c772a2bf
>>> [3] https://dzone.com/articles/applying-back-pressure-when
>>> [4] http://engineering.voxer.com/2013/09/16/backpressure-in-nodejs/
>>> [5] https://github.com/lloyd/node-toobusy
>>> [6] 
>>> https://github.com/pfreixes/cpython/commit/ac07fef5af51746c7311494f21b0f067c772a2bf#diff-08afa52ab2b1511bee8527814ad44d80R1457
>>> 
>> 
>> Hi Pau,
>> 
>> I think your idea is interesting, and maybe can be implemented on top of 
>> something like this: https://github.com/libuv/libuv/pull/1489 So (at a back 
>> of a napkin design level) libuv would provide with some metrics on top of 
>> which you can compute the load in userland.
>> 
>> Or maybe there is benefit in having it baked in, I’m personally open to that 
>> too. I’d appreciate if you chime in into that issue and tell James (I don’t 
>> think he reads this mailing list) about your ideas and refine his proposal 
>> to better cater for your use case.
>> 
>> 
>> Cheers,
>> 
>> --
>> Saúl
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "libuv" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/libuv.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
> --pau
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "libuv" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/libuv.
> For more options, visit https://groups.google.com/d/optout.

--
Saúl

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to