Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Tune Your Go Garbage-Collector

1,937 views

Published on

Slides for the talk given by Bryan Boreham at DotGoEU 2019.

Published in: Software
  • I like this service ⇒ www.HelpWriting.net ⇐ from Academic Writers. I don't have enough time write it by myself.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I can advise you this service - ⇒ www.HelpWriting.net ⇐ Bought essay here. No problem.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Tune Your Go Garbage-Collector

  1. 1. Tune Your Garbage-Collector! @bboreham
  2. 2. Stack vs Heap 2http://www.clipartpanda.com/clipart_images/stack-files-max-39545601 Photo: JohnNyberg, rgbstock.com
  3. 3. GC Tuning Options 3 -Xmsn -Xmxn -XX:-UseConcMarkSweepGC -XX:-UseParallelGC -XX:-UseParallelOldGC -XX:-UseSerialGC -XX:+UseG1GC -XX:+UseGCOverheadLimit -XX:MaxGCPauseMillis=n -XX:InitiatingHeapOccupancyPercent -XX:MaxTenuringThreshold=n -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=n -XX:ConcGCThreads=n -XX:G1ReservePercent=n -XX:G1HeapRegionSize=n -XX:MaxHeapFreeRatio=n -XX:MaxNewSize=size -XX:MaxPermSize=n -XX:MinHeapFreeRatio=n -XX:NewSize=n -XX:NewRatio=n -XX:SurvivorRatio=n -XX:TargetSurvivorRatio=n -XX:+HandlePromotionFailure
  4. 4. GOGC Go GC Options 4
  5. 5. The Go heap. 5
  6. 6. Allocate some more memory 6
  7. 7. Garbage-Collect! 7
  8. 8. Allocate more memory 8
  9. 9. Garbage collect! 9
  10. 10. Allocate much more memory! 10
  11. 11. Garbage collect! 11
  12. 12. Allocate! 12
  13. 13. Garbage collect! 13
  14. 14. Chart it! 14 Growth before next GC Heap size after GC
  15. 15. GOGC 15 100% Heap size after GC
  16. 16. Situation: large stable data set 16 GOGC=50 20 GBytes
  17. 17. Situation: small heap, very rapid GC 17 GOGC=400 10 MBytes
  18. 18. GOGC=off What if we turn off GC completely? 18
  19. 19. GOGC=off go build ./... 19 Normal 7.3 seconds 5.3 seconds GOGC=off
  20. 20. Try it out! 20 Situation Action + - Large static data set GOGC ➡ Smaller heap More CPU Tiny heap, rapid GC GOGC Lower latency More RAM One-shot execution GOGC=off Runs faster May explode
  21. 21. THANK YOU! 21 @bboreham
  22. 22. More information 22 Good explanation of GOGC and other settings https://dave.cheney.net/tag/gogc Really detailed history https://blog.golang.org/ismmkeynote

×