OpenCyber Academy
Rapid course · Lesson 16 · English
Course code: OCA-020Lesson 16: OCA-020-A016

The normal client is fully served until the tight bucket

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Lesson map

Lesson 16. Map, example, EX062.

flowchart TD
  U["90 normal times and 3000 flood times, both sorted"] --> B["Bucket starts full"]
  B --> R["Refill, then serve if a token remains"]
  R --> L["Three printed settings"]

The third line is the first line that drops the normal client.

Logical drawing

limit=5/s burst=20 normal_served= 90/90 flood_served= 319/3000
limit=2/s burst=10 normal_served= 90/90 flood_served= 129/3000
limit=1/s burst= 5 normal_served= 62/90 flood_served=  64/3000

Learning outcomes

After this chapter, you should be able to:

  1. Read both 90/90 lines and the 62/90 line.
  2. Read the flood counts 319, 129 and 64.
  3. Treat the spaces in the third line as part of the format.

16.1 One generator, two sorted lists, three parameter pairs.

random.Random(4) draws 90 times from the uniform range [0, 60) and 3000 times from the same range. Each list is sorted, so the simulator sees increasing timestamps. The bucket starts full, with tokens = burst and last = 0. At each request it refills with min(burst, tokens + (t - last) * rate) and then serves the request if at least one token remains, decrementing by 1.

The pairs are (5, 20), (2, 10) and (1, 5). At 5 per second with burst 20, all 90 normal requests are served and 319 of 3000 flood requests are served. At 2 per second with burst 10, the normal client is still 90/90 and the flood falls to 129. The tight pair is the first to miss ordinary timestamps: 28 of the 90 go unserved, leaving 62, while flood survivors number 64. That pair is 1 per second with burst 5.

The format widths are part of the line. Burst uses width 2, so the third burst prints as a space and then 5. Normal uses width 3. Because the flood field reserves four columns, the two-digit value 64 is indented by two spaces. A transcription that closes those gaps has not copied the print.

Lesson table; scroll horizontally to read all columns →

Setting Normal Flood
5/s, burst 20 90/90 319/3000
2/s, burst 10 90/90 129/3000
1/s, burst 5 62/90 64/3000

16.2 Worked example

Lesson table; scroll horizontally to read all columns →

Choice What the print supports
Prefer 2/s burst 10 when the goal is to keep every normal request in this run 90/90 remains, and the flood is 129 rather than 319
Prefer 1/s because the flood is smallest The normal client loses 28 of 90 requests
Invent a 3/s row No such line was printed

Synthetic case. The two clients are draws on a 60-second line. They are not Tallis staff.

Errors and limits

The smallest flood count is also the count that stops serving the ordinary series. Both columns decide the reading.

Apply

  • EX062 — Three buckets. Which settings serve all 90 normal requests, what does the tight setting do, and which spaces belong in the third line?
    Show marking criteria
    Rubric: 3 = 90/90 then 90/90 then 62/90; floods 319, 129 and 64; the third line pads burst and the flood count;; 2 = the three pairs of counts;; 1 = one setting;; 0 = adds a row.
Worked answers

EX062. At 5/s burst 20 and at 2/s burst 10 the normal client is 90/90, with floods 319 and 129 of 3000. At 1/s burst 5 the normal client falls to 62/90 and the flood is 64/3000. The third line pads the burst to width 2 and the flood count to width 4. No further setting is printed.