-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Incremental GC Tuning Tuning the incremental GC for more conservative collection of larger heaps: 1. GC memory reserve: Keeping a reserve of 640 MB for the incremental GC itself, to be always able to allocate the mark bitmap (128 MB) and have some free space (512 MB) to perform evacuations. This reserve is on top of the 256 MB general reserve for upgrades and query calls. 2. Scheduling the GC more frequently for a medium-sized heap. Until now, there were only two thresholds (critical and non-critical). Threshold | Heap Size | GC-Triggering Growth ----------|------------------|------------------ Low | 0 .. 1 GB | 65% Medium | 1 .. 2.25 GB | 35% Critical | 2.25 .. 3.125 GB | 1% 3. Increasing the GC increment limit, in particular the allocation increment, considering that DTS (deterministic time-slicing) limits have been increased by factor of 10 since the GC design. Increments now have a limit of about 900 million instructions (while the IC message instruction limit is at 20 billion instructions). The allocation increment is increased by a factor of 5 to reduce GC reclamation latency. Focusing on the allocation increment also shows a better performance in the GC benchmark, compared to increasing the base GC increment limit. 4. Scheduling GC also on heartbeats and timers, since DTS is also supported for those. 5. Introducing a system-level GC trigger function that can be called by the canister controller or owner to explicitly run a GC increment. This can be helpful if the canister memory is full and the GC received too little time to complete. This can happen e.g. when a large amount of memory is allocated in a single message or when objects are made unreachable shortly before the memory is exhausted. ``` dfx canister call CANISTER_ID __motoko_gc_trigger "()" ``` This can be called multiple times in a series to complete a GC run. The points 4. and 5. are also applicable to the other GCs. ## GC Measurements According to measurements with the GC benchmark, using `dfx 0.15.1` with the new metering, the changes only have a small effect on the average performance: Metric | Difference ----------------------|----------- Total instructions | +1.8% Allocated memory size | -4.5%
- Loading branch information
1 parent
0e72f43
commit 5a8cd29
Showing
20 changed files
with
287 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.