Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build TiDB with PGO #57502

Open
crazycs520 opened this issue Nov 19, 2024 · 0 comments
Open

Build TiDB with PGO #57502

crazycs520 opened this issue Nov 19, 2024 · 0 comments
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@crazycs520
Copy link
Contributor

crazycs520 commented Nov 19, 2024

Enhancement

Reference: Profile-guided optimization

Build TiDB with PGO has 2% ~ 5% QPS increase in sysbench workloads.

Following Build With PGO test is build TiDB with oltp_point_select CPU profile.

sub-cmd Version Thread QPS AVG Duration QPS Increase
oltp_point_select Origin 128 159274 0.80ms  
oltp_point_select Build With PGO 128 168106 0.76ms 5.5%
oltp_read_only Origin 128 98615 N/A   
oltp_read_only Build With PGO 128 101047 N/A  2.5%
oltp_index_lookup Origin 128 43767 2.92  
oltp_index_lookup Build With PGO 128 46076 2.78 5%

Cluster topology

Component Num GCP instance CPU Core Memory Disk
TiKV 3 n2-standard-16 16C 64G 500G
PD 1 n2-standard-16 16C 64G 100
TiDB 2 n2-standard-16 16C 64G N/A
workload 1 n2-standard-16 16C 64G N/A

Build With PGO Step

  1. Run sysbench point-get workload and grab TiDB CPU profile file.
sysbench --config-file=sysbench.conf oltp_point_select --tables=16 --table-size=1000000 --threads=128 run
curl "http://$TiDB_ID:10080/debug/pprof/profile?seconds=30" > default.pprof
  1. Build TiDB with pgo:
CGO_ENABLED=1  GO111MODULE=on go build -pgo=/dir/default.pprof -tags codes  -ldflags '-X "github.com/pingcap/tidb/pkg/parser/mysql.TiDBReleaseVersion=v8.5.0-alpha-134-g4a6bf46a5f" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBBuildTS=2024-11-17 18:31:07" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBGitHash=4a6bf46a5f7eb494412a342345bffc5c22f5e663" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBGitBranch=master" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBEdition=Community" ' -o bin/tidb-server ./cmd/tidb-server
@crazycs520 crazycs520 added the type/enhancement The issue or PR belongs to an enhancement. label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant