automaxprocs (#6948)

* Add automaxprocs for better multi processor support in containerized environments 

Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>

* correct imports ordering

Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>

* warning instead of fatal

Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>

* fix imports ordering

Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>

---------

Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>
This commit is contained in:
Viktor
2024-11-13 20:36:36 +03:00
committed by GitHub
parent 6e11ebddfc
commit 43fdf737d6
3 changed files with 12 additions and 0 deletions

View File

@@ -12,6 +12,8 @@ import (
"github.com/coredns/caddy"
"github.com/coredns/coredns/core/dnsserver"
"go.uber.org/automaxprocs/maxprocs"
)
func init() {
@@ -56,6 +58,11 @@ func Run() {
os.Exit(0)
}
_, err := maxprocs.Set(maxprocs.Logger(log.Printf))
if err != nil {
log.Println("[WARNING] Failed to set GOMAXPROCS:", err)
}
// Get Corefile input
corefile, err := caddy.LoadCaddyfile(serverType)
if err != nil {