GolangのGCを追う

by Taichi Nakashima,

Go1.5Go1.6GoGCGoGC

GoGC

GoGC


GoGC20165

Go1.4Stop The WorldSTWGCGo1.5GC10msGo1.5Go1.6

Go1.5


GopherCon 2015: Rick Hudson - Go GC: Solving the Latency Problem

3.0s0s


https://twitter.com/brianhatfield/status/634166123605331968

Billions of request per day meet Go 1.5 (The new version of Go reduces our 95-percentile garbage collector from 279 milliseconds down to just 10 ms)


Go1.6


QCon: Go GC: Prioritizing Low Latency and Simplicity

Go1.5Go1.510Go1.550GBGo1.6250GB10ms

Go1.7Twitter@brianhatfieldCanaryGC


Go 1.7 observed performance changes (production canary@eeca3ba)


GoGC



GCGoGCGC

GC


 - GCGCGC50runtimePythonV8GC

 - 20163GC/GoConcurrent GC


GoGCRick Hudson


GopherCon 2015: Rick Hudson - Go GC: Solving the Latency Problem (slide)

Go GC: Prioritizing low latency and simplicity

Go 1.4+ Garbage Collection (GC) Plan and Roadmap


GopherConQconGo1.6




On-the-Fly Garbage Collection: An Exercise in Cooperation - 

Sapphire: Copying GC Without Stopping the World - GC


runtime packagemgc.go


https://golang.org/src/runtime/mgc.go


Go1.4GCstackovwerflow


What kind of Garbage Collection does Go use?




Rick HudsonGoGC10使

GoGCGCGC

GoGC


Go1.5GCConcurrent Mark & SweepGCTri-color markig

Mark & Sweep


Mark & SweepMark & SweepGCMarkSweep2Mark辿Sweep

Mark & Sweep使?使

GC?


GCGCStop The WorldSTWGC

GCSweepGC

GCWebGCSTW使

Go1.4GCSTWTri-color markingConcurrent GCSTW

Tri-color marking


GCGCGCGCTri-color markingGC

Tri-color markingGC3


 - 

 - 

 - 


Mark & SweepTri-color marking使3GC


 - 

 - 

 - 


GC




ABBCA?CCB

2







Generational GCGC使GCDijkstraBCBB

GC

Concurrent Mark & Sweep


ConcurentGoGC

GoOSGoroutineruntimePThe Go scheduler GCPack

GCConcurrent GCGCGomarkterminationGC

GOGCGOGC


GCJavaxmsxmxGo1GOGCGC

GOGCGo1A whirlwind tour of Gos runtime environment variablesGCAggressiveness

100GC100%2GC

?200GC200%3GCGCRAMGC使

GC使offGC

GoGCRAM2GOGC2GC


GoGCGCGC

GCGo