go-watchdog

a library to curb OOMs by running Go GC according to a user-defined policy.

OTHER License

Stars
81
Committers
4

Bot releases are hidden (Show)

go-watchdog - Release 1.3.0 Latest Release

Published by Stebalien over 2 years ago

go-watchdog - v1.2.0

Published by raulk almost 3 years ago

  • introduce the possibility of receiving a callback before forced GC runs; this gives the application the opportunity to shed resources to be collected on imminent GC.
  • introduce the possibility of customizing the funciton that runs on forced GC; this enables the application to more aggressively return memory to the OS by setting it to debug.FreeOSMemory.

Thanks to @marten-seemann for the contributions!

go-watchdog - v1.1.0

Published by raulk almost 3 years ago

go-watchdog now supports multiple GC notifees. The global NotifyGC variable is deprecated, and has been replaced with a RegisterNotifee function. NotifyGC is still invoked if non-nil, but it will be removed entirely in future releases.

Thanks to @marten-seemann for this feature.

go-watchdog - v1.0.1

Published by raulk over 3 years ago

This contains minor adjustments:

  • minimum GOGC on heap watchdog to prevent GC overscheduling.
  • write heap profiles instead of heap dumps.
  • minor logging adjustments.
go-watchdog - v1.0.0

Published by raulk over 3 years ago

This release introduces major changes.

Refactors

  • HeapDriven and SystemDriven are now distinct run modes.
  • Policies are now stateless, pure, and simplified. Policies now return a single value: the next utilization at which GC should run. The watchdog honours that target differently depending on the run mode.
  • The HeapDriven watchdog now adjusts GOGC dynamically, based on the policy's target, thus delegating the scheduling of GC to the runtime. This results in a higher reliability, that is not to quick memory bursts within sampling periods.
  • The SystemDriven watchdog remains a polling watchdog.
  • The emergency and silence features of the watermark policy have been removed.

cgroup-driven watchdog

A new cgroup-driven watchdog has been implemented. This watchdog discovers the memory limit from the cgroup of the process (derived from /proc/self/cgroup), or from the root cgroup path if the PID == 1 (which indicates that the process is running in a container). It uses the cgroup stats to obtain the current usage.

automatic heapdump capture

A heapdump will be captured when the usage trespasses a configured threshold. Staying above the threshold won't trigger another heapdump. If the usage goes down, then back up, that is considered another "episode" to be captured in a heapdump. The behaviour is controlled by the Heapdump* global variables.

immune to panics

If a panic occurs in the watchdog, it will be swallowed and the watchdog will be disarmed.

go-watchdog - v0.0.1

Published by raulk almost 4 years ago

initial release