Repository navigation
Start generated apps with an 8 MiB heap - #60
Merged
Merged
Conversation
Measured on an Amber CLI app with the Post scaffold (amber v2-dev with the Logger and Compression changes, crystal-alpha release build), 32 connections: peak RSS at 8 MiB is 15.2 MiB on GET /, 15.5 MiB on GET /api/posts and 16.8 MiB on POST /posts, against 23.5, 24.0 and 25.6 MiB at 16 MiB. The 16 MiB heap collects less often, so GET /api/posts and POST /posts used about 18% less CPU per request there; the README says how to make that trade.
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.
Generated apps now start the garbage collector with an 8 MiB heap (
server.gc_initial_heap_mib: 8in every environment file), down from 16 MiB, so a generated app stays under 20 MiB of memory under load. The constant's comment and the generated README state the trade and how to raise the value per environment (config/environments/*.ymlorAMBER_SERVER_GC_INITIAL_HEAP_MIB).Measurements
Harness:
home-page-memory-bench(mem.rb,mem_post.rb) on an app from this branch's generator with the Post scaffold and 50 seeded rows,crystal-alpha build --release(Crystal 1.21.0, LLVM 21.1.8), arm64 macOS, production mode, one process, oha. "All" = amber v2-dev with amberframework/amber#1456 (Logger), #1457 (pooled compression) and #1458 (asset tags); "base" = amber v2-dev 814705ee. The machine was shared with heavy jobs (load average 40 to 270), so requests/s and p99 are approximate; peak RSS, bytes and CPU time per request are the steadier figures.Sweep on "all": starting heap 0, 4, 8, 16 MiB at 1, 4 and 32 connections (15 s, 2 rounds, interleaved)
8 against 16 MiB, base and all, 32 connections (15 s, 3 rounds, interleaved ABBA)
The choice: 8 MiB
Specs
spec/commands/new_command_spec.crchecks the constant is 8, that all three environment files carry it, and that the README names the setting and the trade-off.