Repository navigation
Generate apps with a 16 MiB starting GC heap - #56
Merged
Merged
Conversation
Every generated environment file sets server.gc_initial_heap_mib: 16, and the generated README says where to change it. 16 MiB is the smallest starting heap that kept POST /posts p50 at or below beta.10 in a generated app with the beta.11 changes; 4 and 8 MiB did not. Amber reads the key once amberframework/amber#1452 is in the pinned release; earlier Amber ignores it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
amber newwritesserver.gc_initial_heap_mib: 16intodevelopment.yml,test.ymlandproduction.yml, and the generated README's "What is on by default" section says where to change it (the YAML key orAMBER_SERVER_GC_INITIAL_HEAP_MIB). The value lives in one constant,NewCommand::GC_INITIAL_HEAP_MIB.Amber reads the key from amberframework/amber#1452 (a typed
ServerConfigsetting that grows Boehm GC's heap at server start). Until the template pins an Amber release with that PR, Amber ignores the key (server settings are not strict), so this is safe to land in either order.Why 16 MiB
Starting-heap sweep on a generated
amber new -d sqliteapp (Amber CLI 2.0.10 scaffold, 50 seeded posts), beta.11 PR set (amber #1451, grant #73, asset_pipeline #25) against beta.10 at its default heap. Settings: oha, 32 connections, 30 s per run, 10 interleaved pairs, default log level, production mode, one process. POST /posts (form + CSRF):The 4 MiB, 8 MiB and production.yml rows come from a second interleaved run with its own A. 16 MiB is the smallest value whose POST p50 interval is at or below 1.0. Every GET row at 16 MiB is neutral or better except peak RSS on the small JSON route (GET /api/posts: 17.7 -> 25.6 MiB, +7.9 MiB), the memory the starting heap itself takes. 32 MiB and up add a GET /posts p99 regression and more memory. Full tables:
heap-tuning.mdin the perf-regression report folder.Specs
spec/commands/new_command_spec.cr("tuned defaults"): every generated environment file carriesserver.gc_initial_heap_mibequal to the constant, the constant is above 0, and the README names the key. Local run with crystal-alpha: 174 examples, 0 failures;crystal tool format --check src specclean;scripts/check_beta_contract.shpasses.