tgoop.com/golanglibrary/1031
Create:
Last Update:
Last Update:
Graceful Shutdown in Go: Practical Patterns
Graceful shutdown in any application generally satisfies three minimum conditions:
1. Close the entry point by stopping new requests or messages from sources like HTTP, pub/sub systems, etc. However, keep outgoing connections to third-party services like databases or caches active.
2. Wait for all ongoing requests to finish. If a request takes too long, respond with a graceful error.
3. Release critical resources such as database connections, file locks, or network listeners. Do any final cleanup.
This article focuses on HTTP servers and containerized applications, but the core ideas apply to all types of applications.
https://victoriametrics.com/blog/go-graceful-shutdown/index.html
BY Go Library
Share with your friend now:
tgoop.com/golanglibrary/1031
