max / makenotwork
| 1 | #!/usr/bin/env bash |
| 2 | # The alternating-pairs protocol for measuring the description layer. |
| 3 | # |
| 4 | # S3 ran Askama / described / described / Askama by hand. Running it by hand is |
| 5 | # how a measurement ends up not comparable with the one before it: the mix, the |
| 6 | # VU count and the described set all have to be identical across the four runs, |
| 7 | # and only the middle two differ in what serves the screens. |
| 8 | # |
| 9 | # Two things this answers that S3's numbers do not: |
| 10 | # |
| 11 | # ACCUMULATION. S3 measured ONE described screen in an otherwise-Askama mix, |
| 12 | # and its verdict rests on database connection occupancy, which is exactly the |
| 13 | # quantity that grows with the number of described screens. Six are converted. |
| 14 | # Default here is all six. |
| 15 | # |
| 16 | # THE MULTITHREADED REGIME. The two forum screens' work is an outbound HTTP |
| 17 | # call, not a query, and the described version holds a BLOCKING-POOL thread |
| 18 | # across it where Askama pays the same latency on a runtime worker. Sweep |
| 19 | # MT_LATENCY to find the upstream latency at which that starts to cost |
| 20 | # something. Sizing the pool is a config line either way, so the output worth |
| 21 | # having is the threshold, not a pass/fail. |
| 22 | # |
| 23 | # Usage: |
| 24 | # scripts/load-conversion-ab.sh # all six screens, 0ms upstream |
| 25 | # MT_LATENCY=500 scripts/load-conversion-ab.sh # slow Multithreaded |
| 26 | # SCREENS=user_ssh_keys scripts/load-conversion-ab.sh # reproduce S3's shape |
| 27 | # |
| 28 | # Read the report's `Rej` column before reading anything else. A rejected request |
| 29 | # is fast, so a route answering 403 or 404 wins a latency comparison it never ran. |
| 30 | # |
| 31 | # THE PROFILE IS RELEASE, and it is here rather than in shell history so a later |
| 32 | # reader knows which one produced the numbers. Render cost is the quantity being |
| 33 | # compared, and in debug it is dominated by unoptimized rendering, so a debug |
| 34 | # sweep measures rustc's -O0 output more than it measures the description layer. |
| 35 | # S3's section in the wiki does not record its profile, so treat any comparison |
| 36 | # against S3's figures as indicative rather than exact. |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | # Half the virtual users on the dashboard is far above a real day. It is chosen |
| 42 | # so the described routes see enough concurrency to say anything at all; a |
| 43 | # production-shaped mix puts one user on them and one user reaches no contention. |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | # Built once, outside the timed runs: a cold compile inside run 1 would show up |
| 62 | # as run 1 being slower than run 4, which is the shape the alternation exists to |
| 63 | # cancel out. |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | QUASI_SCREENS="" \ |
| 74 | | | |
| 75 | |
| 76 | } |
| 77 | |
| 78 | # Askama, described, described, Askama. The pairs are inner and the controls are |
| 79 | # outer so a drift in the box over the run (thermal, page cache, another process |
| 80 | # arriving) lands on both sides rather than on one. |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 |