> On May 1, 2018, 9:25 a.m., Zhitao Li wrote:
> > 3rdparty/libprocess/include/process/metrics/push_gauge.hpp
> > Lines 70-75 (patched)
> > <https://reviews.apache.org/r/66828/diff/1/?file=2013207#file2013207line70>
> >
> >     Hmm, is there a possible race condition here?
> >     
> >     Consider two threads calling this with `v=2` and `v=3`, and initial 
> > value as `0`, and the order would be:
> >     
> >     T1: `fetch_add(2)`, `prev` in T1 == 0;
> >     T2: `fetch_add(3)`, `prev` in T2 == 2;
> >     T2: `push(2 + 3)`, metric value is 5;
> >     T1: `push(0 + 2)`, metric value is 2.
> >     
> >     Metric value and cached value in gauge would be out of sync due to the 
> > race condition?

My bad, realized that `push()` is only used as history. Actual sampling happens 
through `value()` function. Please ignore my comment.


- Zhitao


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


On April 26, 2018, 2:54 p.m., Benjamin Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66828/
> -----------------------------------------------------------
> 
> (Updated April 26, 2018, 2:54 p.m.)
> 
> 
> Review request for mesos, Gaston Kleiman, Gilbert Song, Greg Mann, James 
> Peach, and Vinod Kone.
> 
> 
> Bugs: MESOS-8851
>     https://issues.apache.org/jira/browse/MESOS-8851
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> A push-based gauge differs from a pull-based gauge in that the
> client is responsible for pushing the latest value into the gauge
> whenever it changes. This can be challenging in some cases as it
> requires the client to have a good handle on when the gauge value
> changes (rather than just computing the current value when asked).
> 
> It is highly recommended to use push-based gauges if possible as
> they provide significant performance benefits over pull-based
> gauges. Pull-based gauge suffer from delays getting processed on
> the event queue of a `Process`, as well as incur computation cost
> on the `Process` each time the metrics are collected. Push-based
> gauges, on the other hand, incur no cost to the owning `Process`
> when metrics are collected, and instead incur a trivial cost when
> the `Process` pushes new values in.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/Makefile.am 
> cd2c3bc62df8de5b50ec2fa830b3e2634ba11e28 
>   3rdparty/libprocess/include/process/metrics/push_gauge.hpp PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/66828/diff/1/
> 
> 
> Testing
> -------
> 
> Test added in the subsequent patch.
> 
> 
> Thanks,
> 
> Benjamin Mahler
> 
>

Reply via email to