Skip to content

Commit 39ecb71

Browse files
committed
Disabling GC at handler level
1 parent 25ac584 commit 39ecb71

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

httphandler/handler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"net/http"
66
"runtime"
7+
"runtime/debug"
78
)
89

910
const (
@@ -14,6 +15,8 @@ const (
1415
// GCI returns the GCI HTTP handler, which controls Go's GC to decrease service tail latency.
1516
// Ideally, GCI handler should be the first middleware in the service process chain.
1617
func GCI(next http.HandlerFunc) http.HandlerFunc {
18+
debug.SetGCPercent(-1)
19+
fmt.Println("==< Automatic GC Disabled <==")
1720
return func(w http.ResponseWriter, r *http.Request) {
1821
switch r.Header.Get(gciHeader) {
1922
case "":

0 commit comments

Comments
 (0)