# Explore the effects of latency instability. Set up an elastic limit of 20% and
# further below, a set-point of the same. We'll simulate two workloads under
# different latency stability values.
init limit=20%
----

# Simulate 500 ticks where the random component in the latency function is
# relatively large.
tick
p99=1ms ticks=1 util-fraction=0.0
p99=1ms ticks=1 util-fraction=+0.01
----

auto set-point=40% ticks=500 m=10 c=100
----


# Simulate 500 ticks where the random component in the latency function is
# relatively small.
tick
p99=1ms ticks=1 util-fraction=0.0
p99=1ms ticks=1 util-fraction=+0.01
----

auto set-point=40% ticks=500 m=10 c=20
----

# Plot the two workloads. Too much input instability (left) can lead to under
# utilization and jaggedness in the controller output.
plot width=70 height=20
----
----
 1033 ┤                           ╭╮           ╭╮
 1011 ┤                         ╭╮││╭╮  ╭╮     │╰─╮╭╮ ╭╮
  990 ┼─────────────────────────────────────────────────────────────────────
  969 ┤│     ╭╮    ╭─╯╰╮  │╰╯│  │││││╰╮│ │     │  ╰╯ ╰╯ ╰╯  ╰╯        ╰─╯╰╯╰
  948 ┤│     ││╭╮╭─╯   │╭╮│  ╰╮ │││││ ││ │    ╭╯
  927 ┤│     │╰╯╰╯     ││││   │ │││││ ││ │    │
  905 ┤│     │         ││││   │╭╯││││ ╰╯ │    │
  884 ┤│     │         ││╰╯   ╰╯ ╰╯╰╯    │   ╭╯
  863 ┤│     │         ╰╯                │   │
  842 ┤│     │                           │   │
  820 ┤│     │                           │  ╭╯
  799 ┤│    ╭╯                           │  │
  778 ┤│    │                            │  │
  757 ┤│  ╭╮│                            │  │
  736 ┤│╭╮│││                            │  │
  714 ┤││││╰╯                            │ ╭╯
  693 ┤││││                              │ │
  672 ┤││╰╯                              │╭╯
  651 ┤││                                ││
  630 ┤╰╯                                ││
  608 ┤                                  ╰╯
                           p99 scheduler latencies (μs)


 45.0 ┤                                       ╭─╮
 42.8 ┤                                     ╭─╯╭─╮
 40.5 ┤                                    ╭╯  │ ╰╮╭───╮╭╮  ╭────╮╭╮ ╭╭───╮
 38.3 ┤                                  ╭─╯   │  ╰╯  ╰╰────╯    ╰╯╰──╯ ╰╯╰─
 36.0 ┤            ╭╮   ╭────╮ ╭─────────╮    ╭╯
 33.8 ┤         ╭───────╯╯   ╰─╯    ╰╯   │    │
 31.5 ┤       ╭─╯                        │    │
 29.3 ┤      ╭╯                          │   ╭╯
 27.0 ┤    ╭─│                           │   │
 24.8 ┤  ╭─╯╭╯                           │   │
 22.5 ┤ ╭╯  │                            │   │
 20.3 ┼─╯  ╭╯                            │  ╭╯
 18.0 ┤    │                             │  │
 15.8 ┤    │                             │  │
 13.5 ┤   ╭╯                             │ ╭╯
 11.3 ┤  ╭╯                              │ │
  9.0 ┤  │                               │╭╯
  6.8 ┤ ╭╯                               ││
  4.5 ┤ │                                ││
  2.3 ┤╭╯                                ╰╯
  0.0 ┼╯
                       elastic cpu utilization and limit (%)
----
----

# vim:ft=sh
