Skip to content

Flood inspired fluid optimization for load reduction while flooding happens - #503

Open
mattiapearl wants to merge 1 commit into
PaperMC:ver/26.2.xfrom
mattiapearl:research/folia-fluid-process-budget
Open

Flood inspired fluid optimization for load reduction while flooding happens#503
mattiapearl wants to merge 1 commit into
PaperMC:ver/26.2.xfrom
mattiapearl:research/folia-fluid-process-budget

Conversation

@mattiapearl

Copy link
Copy Markdown

With the inspiration of the flooding of DonutSMP I figured that Folia’s regional fluid limits multiply across separated floods. What we can do is place an optional fair ceiling on total process execution and schedule to delay rather than fully deleting it. Protects all resources impacted by flooding (CPU, allocation, heap and network loads).

Benchmarks

  • Executor: Pi AI agent
  • Direction and code review: contributor
  • Runtime: Java 25, eight Folia region threads, 4 GiB heap, seed 8675309, fresh worlds
  • Instrumentation: JFR, Folia regional profiler, queue counts, heap, storage records, and protocol clients

Public Folia scaling baseline

Fifteen-second one-flood versus four-flood runs:

Metric One flood Four floods Scaling
Executed fluid ticks 518,646 2,076,950 4.005×
Allocation estimate 42.2 MB/s 169.7 MB/s 4.020×

Region files, records, and stored bytes also scaled approximately fourfold while regions remained near 20 TPS.

Five stock/five controller four-region trials

These paired results measured the v7 precursor allocator at a process maximum of 2,000 fluid ticks per 50 ms:

Metric Stock median Controller median Change
Executed fluid ticks 1,378,881 393,225 −71.48%
Fluid phase 3,363 ms 1,041 ms −69.05%
Regional average MSPT 5.350 2.110 −60.56%
Allocation estimate 172.60 MB/s 57.04 MB/s −66.95%
Used heap 2.184 GB 1.026 GB −53.00%
Queued ticks 35,068 35,195 +0.36%
Target-region storage 19,472,384 B 19,472,384 B 0%

Final implementation smoke

With process-maximum: 2000 per 50 ms over four regions:

  • 804 profiled regional ticks
  • 398,500 fluid ticks granted
  • 392,746 fluid ticks consumed
  • 98.56% grant utilization
  • Per-region consumption: 97,555–98,713
  • Total execution remained within the expected approximately 400,000-tick ten-second envelope.

Non-binding controller test

Five stock/candidate pairs with a 65,536-per-50-ms process maximum:

  • Executed-work difference: approximately +0.003%.
  • No controller overhead was detected.
  • The incidental fluid-time difference was not treated as evidence of a speedup.

Real-client network campaign

Four floods with four protocol clients:

Metric Stock Controller Change
TCP bytes 1,533,149 744,534 −51.44%
Decoded bytes 3,494,911 1,427,938 −59.14%
Multi-block bytes 2,198,993 707,232 −67.84%
Light-update bytes 1,272,421 709,230 −44.26%
Packet count 7,982 6,869 −13.95%

The protocol bot advertised 26.2 protocol 776 using available 26.1 packet definitions. TCP counters are exact; parser-level packet classifications carry that limitation.

AI assistance disclosure

  • AI materially assisted—not merely autocomplete.
  • Primary model: gpt-5.6-sol, maximum reasoning.
  • Seven gpt-5.6-terra:medium research agents.
  • Two gpt-5.6-luna:low read-only scouts.
  • Assistance covered research, code inspection, implementation, tests, benchmark harnesses, analysis, and issue/PR searches.
  • No independent AI reviewer was used.
  • The passive review ledger only recorded prompts/responses; it did not perform review.
  • I reviewed all the code, understand it, and accept responsibility for the contribution.

Folia applies the existing fluid tick limit independently to each
ticking region, so aggregate work can grow with the number of active
regions. Add an opt-in process-wide allocation with regional floors,
equal sharing, bounded age weighting, rotating tie order, configuration
validation, profiler counters, and allocator tests. Scheduled work is
delayed rather than discarded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant