dcapwell commented on code in PR #28:
URL: https://github.com/apache/cassandra-accord/pull/28#discussion_r1092243172
##########
accord-core/src/test/java/accord/impl/basic/DelayedExecutorService.java:
##########
@@ -0,0 +1,107 @@
+package accord.impl.basic;
+
+import accord.burn.random.Decision;
+import accord.burn.random.IntRange;
+import accord.burn.random.RandomInt;
+import accord.burn.random.SegmentedIntRange;
+import org.apache.cassandra.concurrent.FutureTask;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.AbstractExecutorService;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+public class DelayedExecutorService extends AbstractExecutorService
+{
+ private final PendingQueue pending;
+ private final Random random;
+ private final RandomInt jitterInNano;
+
+ public DelayedExecutorService(PendingQueue pending, Random random)
+ {
+ this.pending = pending;
+ this.random = random;
+ this.jitterInNano = new SegmentedIntRange(
+ new IntRange(microToNanos(0), microToNanos(50)),
+ new IntRange(microToNanos(50), msToNanos(5)),
+ // this is different from Apache Cassandra Simulator as this
is computed differently for each executor
Review Comment:
> Ideally it would probably be per-node for both
makes sense, nodes coordinating to act badly at the same time isn't
realistic.
> I thought the C* simulator also used the random walk behaviour for jitter,
but it looks like it doesn't. It would be good if both did, to simulate nodes
becoming unhealthy for a period
At least in this context I see `RandomWalkDecision` and tested and don't see
such a behavior... Changed test to `RandomWalkPeriod` and see do see some
logical temporal behavior but don't 100% grasp why yet; below are the results
in my testing
```
# RandomWalkDecision for 10k samples
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 3 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 3 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 4 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
True seen 2 times in a row
```
```
# RandomWalkPeriod for 10k samples
Seq 82
Seq 136
Seq 18
Seq 4
Seq 2
Seq 7
Seq 3
Seq 8
Seq 3
Seq 10
Seq 34
Seq 5
Seq 15
Seq 214
Seq 13
Seq 2
Seq 6
Seq 216
Seq 243
```
The result are sequences seen where the result is > the mid point of the
range, so with `new LongRange(100, 2000, MICROSECONDS, NANOSECONDS)` those are
sequences seen greater than 1ms.
I do agree this type of behavior is desirable, so will take a look at this
logic and see if I can get a working `Decision` that has a temporal behavior of
returning `true`; ill time box it to a 1-3h though
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]