Hello,

We are using Gin for our project. However, without adding any additional routes or configurations—just starting the Gin server with the following setup—we are encountering an issue.

runtime.GOMAXPROCS(runtime.NumCPU())
    router := gin.New()
    router.Use(gzip.Gzip(gzip.DefaultCompression))
    err := router.RunTLS(fmt.Sprintf("%s:%s", viper.GetString("server.Ip"), viper.GetString("server.Port")), globalConfiguration.EnvConfig.HttpsConfigParams.ServerCertificatePath, globalConfiguration.EnvConfig.HttpsConfigParams.PrivateKeyPath)
    if err != nil {
        log.Fatal(router.Run(fmt.Sprintf("RunTLS error: %s", err.Error())))
    }

Please find attached screenshot for cpu utilization.

Image

Comment From: AmiZya

Try to run a profiler on your program and see which part is consuming too much CPU, check this link: https://go.dev/blog/pprof

Comment From: NayabChauhan

Try to run a profiler on your program and see which part is consuming too much CPU, check this link: https://go.dev/blog/pprof

thanks @AmiZya but i did run profiler and there is nothing that I found. Thats a reason only have above code in my program and still High CPU, so is it some configuration I am missing coz tried all like "COMPRESSION" changes and runtime CPU and more.

Comment From: truongbo17

try starting gin normally, then add your configs and see where the problem is