> On May 7, 2014, 3:55 p.m., Ben Mahler wrote: > > I thought we were going to leave the 'deferred' constructor (asynchronous) > > and provide an overload for a function<double> (synchronous) constructor? > > With the function<double> constructor, we need to use async() to wrap the > > function and ensure we don't block MetricsProcess. > > > > If we were to expose function<Future<double> as currently done, then it's > > not possible to tell if the function is actually asynchronous, and we'd > > have to always wrap it with 'async()' to ensure we don't block, no? For > > asynchronous functions the unneeded wrapping seems unfortunate.
You're absolutely right - but we have different assumptions. You are assuming that we always want Gauge to be asynchronous, I am expecting there are cases when it is reasonable to not be. For example, when getting the queue size from the Master. My expectation: constructed with a std::function - function call is synchronous and potentially blocks MetricsProcess. constructed with a Deferred - function call is asynchronous and doesn't block MetricsProcess. I understand this means that the user can potentially block MetricsProcess by not deferring, however it means we don't incur the overhead of process::async just to call a simple method. If you think this is too fragile, then yes, we'd have to have two overloads (or maybe two Gauge types: Gauge and DeferredGauge). We could then store Options in the shared data structure and decide whether to use async depending on which is set. Perhaps the two types is cleaner? - Dominic ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/20995/#review42435 ----------------------------------------------------------- On May 2, 2014, 12:52 p.m., Dominic Hamon wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/20995/ > ----------------------------------------------------------- > > (Updated May 2, 2014, 12:52 p.m.) > > > Review request for mesos and Ben Mahler. > > > Bugs: MESOS-1286 > https://issues.apache.org/jira/browse/MESOS-1286 > > > Repository: mesos-git > > > Description > ------- > > see summary. > > This allows synchronous Gauge methods which reduces potential process queue > pressure. > > > Diffs > ----- > > 3rdparty/libprocess/include/process/metrics/gauge.hpp > af06534622b3f00c1d1dc5c577527375318fd79a > 3rdparty/libprocess/src/tests/metrics_tests.cpp > 75f1f0e35fdb1ec707785d1ebb903af99551bdaa > > Diff: https://reviews.apache.org/r/20995/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Dominic Hamon > >
