Go version
go version go1.23.5 linux/amd64
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/transaction/.cache/go-build'
GOENV='/home/transaction/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/transaction/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/transaction/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/transaction/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.5.linux-amd64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/transaction/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.5.linux-amd64/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.5'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/transaction/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/transaction/tidb/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build338251587=/tmp/go-build -gno-record-gcc-switches'
What did you do?
Building with PGO, but result in performance regressions.
The build flag is:
CGO_ENABLED=1 GO111MODULE=on go build -tags codes -pgo=default.pgo -ldflags '-X "github.com/pingcap/tidb/pkg/parser/mysql.TiDBReleaseVersion=v9.0.0-alpha-206-gaccc969cd5" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBBuildTS=2025-01-23 06:01:16" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBGitHash=accc969cd5e95a992368249fcf86f11887e7b11a" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBGitBranch=pgo-read-only-dev5" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBEdition=Community" ' -o bin/tidb-server ./cmd/tidb-server
Then start the TiDB and run sysbench test, following is the test result, the QPS of building with PGO is lower.
| workload |
thread |
Version |
QPS |
| batch_get |
64 |
without-pgo |
23165 |
| batch_get |
64 |
with-pgo |
21077 |
What did you see happen?
The performance of build with PGO is worse because newstack appeared during execution.
profile.zip
CPU profile of building without PGO:
CPU profile of building with PGO:
What did you expect to see?
no newstack during execution.
Is there any way to avoid newstack during execution, such as set stack size when creating goroutine?
Go version
go version go1.23.5 linux/amd64
Output of
go envin your module/workspace:What did you do?
Building with PGO, but result in performance regressions.
The build flag is:
Then start the TiDB and run sysbench test, following is the test result, the QPS of building with PGO is lower.
What did you see happen?
The performance of build with PGO is worse because
newstackappeared during execution.profile.zip
CPU profile of building without PGO:
CPU profile of building with PGO:
What did you expect to see?
no
newstackduring execution.Is there any way to avoid
newstackduring execution, such as set stack size when creating goroutine?