> On June 16, 2015, 10:02 p.m., Ben Mahler wrote:
> > High level review, why don't we just have an abstraction for limiting the 
> > number of concurrent operations?
> > 
> > You could keep this abstraction local to this file for now and consider 
> > pulling it out into libprocess.
> > For example, rather than using a 'RateLimiter' here, we use a 
> > 'ConcurrencyLimiter':
> > 
> > ```
> > // Limits concurrency of asynchronous operations.
> > class ConcurrencyLimiter
> > {
> > public:
> >   ConcurrencyLimit(size_t concurrency);
> >   
> >   // Adds a unit of asynchronous work to execute. The work may
> >   // be postponed to ensure the concurrency limit is not violated.
> >   // Returns the result of the work.
> >   template <typename T>
> >   Future<T> add(const std::function<Future<T>& work);
> > };
> > ```
> > 
> > Then you only need a fairly clean, minimal change to the existing source to 
> > leverage this, and you can use it elsewhere too.
> > Not sure if 'ConcurrencyLimiter' is the clearest name, but hopefully you 
> > get the high level idea.
> 
> Jie Yu wrote:
>     +1
>     
>     I like this idea! Remember that we have an abstraction `Sequence` in 
> libprocess (3rdparty/libprocess/include/process/sequence.hpp). It has the 
> same interface as this one, but the semantics is different (as you can tell 
> from the name). I would probably call it `Parallel(size_t concurrency)`.

Hi Ben/Jie,

That sounds great to me as well! And in the end we simply just return the list 
of all the results, so I think we can then do a collect call on all the futures 
to aggregate the results.

Lily how does that sound to you?


- Timothy


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/35330/#review88134
-----------------------------------------------------------


On June 11, 2015, 9:39 p.m., Lily Chen wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/35330/
> -----------------------------------------------------------
> 
> (Updated June 11, 2015, 9:39 p.m.)
> 
> 
> Review request for mesos and Timothy Chen.
> 
> 
> Bugs: MESOS-2797
>     https://issues.apache.org/jira/browse/MESOS-2797
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Capped number of parallel inspect instances on a docker ps call.
> 
> 
> Diffs
> -----
> 
>   src/docker/docker.hpp 7790d0ff9a6b085025f595533c5f46b702447927 
>   src/docker/docker.cpp 71383294c6234d08b2156565b170ada329b8e30f 
>   src/slave/constants.hpp 84927e589499e989249c217db571bbeb84a88af1 
> 
> Diff: https://reviews.apache.org/r/35330/diff/
> 
> 
> Testing
> -------
> 
> sudo ./mesos-tests.sh --gtest_filter="*DOCKER*" --gtest_break_on_failure 
> --gtest_shuffle --gtest_repeat=30
> 
> 
> Thanks,
> 
> Lily Chen
> 
>

Reply via email to