How much memory per connection? • Does the system reclaim memory that's no longer used? • What's the garbage collector doing? CODEBUG=gctrace=1 • Where is memory allocated? (PPROF)
17
Know Your Service: PPROF
18
Don't leak goroutines!
19
PPROF: From the Command Line
20
Know Your Service: Watch It Run
21
Keep Good Logs! • Create a semi-unique string per request • Use this request string as a prefix in all log entries • Always log at least the start and end of a request
22
Drain and Die
23
Game Day.
24
Wolfram Alpha Tells Me: 4MB X 10 = 40MB
25
Prod Profiling Told Me: This memory will be reclaimed
Description:
Explore the development of Fog Creek's first production Go service in this GopherCon 2015 talk. Learn how to build resilient services using Go by examining the rewrite of a Git and Mercurial SSH reverse proxy from Python. Discover techniques for monitoring memory, tracking user connections and actions, implementing drain-and-die functionality, and creating detailed forensic logs. Gain insights into improving response times, extending uptime, and enhancing crash analysis. Delve into topics such as concurrency, error handling, channel usage, panic management, race condition avoidance, timeout implementation, and memory optimization. Understand the importance of proper logging, profiling with PPROF, and conducting game day exercises. Apply these lessons to create robust and efficient Go services in your own projects.