tomcucinotta / distwalk

Distributed processing emulation tool
GNU General Public License v3.0
1 stars 4 forks source link

add probabilistic SKIP #31

Closed tomcucinotta closed 6 months ago

tomcucinotta commented 9 months ago

In addition to #8, supporting forwarding of the same request to multiple nodes, it would be nice to support the ability to forward on one out of a number of nodes, with some pre-specified probability. Actually, generalizing the idea, we could have probabilistic execution of arbitrary segments of the specified command/script.

This might be done introducing a probabilistic skip construct, e.g.:

  SKIP(n[, p=1.0])

would skip the next n commands with probability p, and execute them with probability (1-p) instead.

For example, to emulate a random load-balancer: SKIP(2, 0.66) FORWARD(ip1) ... REPLY SKIP(4) SKIP(2, 0.5) FWD(ip2)...REPLY SKIP(1) FWD(ip3)...REPLY

Here, the first SKIP does a skip 66% of the times, and executes the first FWD and the subsequent deterministic SKIP only 34% of the times. In those 66% skipped instances, it finds another PROB_SKIP, doing 50% of the times the forward to ip2, and 50% to ip3. Overall, it's a 34%, 33%, 33% distribution among ip1, ip2 and ip3. When skipping, a FORWARD is being considered here as a single construct to split, for ease of specification, and also because I can't find a sense of leaving the ability tojump in the middle of a FORWARD body.

Other example: restore the (now lost) ability to have a random workload of LOAD, STORE: SKIP(2,0.7) SAVE() SKIP(1) LOAD()

We're doing a SAVE 30% of the times, and a LOAD 70% of the times.

In terms of command-line syntax, AFAICS, this can be as straightforward as:

--skip n[,prob=1.0]

AFAICS, this might be realized entirely client-side, i.e., dw_node would never see the SKIP command, rather dw_client would send requests with various probabilistically distributed contents according to the specified probabilistic skips. Albeit, supporting that also server-side doesn't seem difficult at all.

tomcucinotta commented 6 months ago

This is handled by the commits above, closing.