bytedance / g3

Enterprise-oriented Generic Proxy Solutions
Apache License 2.0
413 stars 30 forks source link

Evaluate Profile-Guided Optimization (PGO) and LLVM BOLT #126

Open zamazan4ik opened 9 months ago

zamazan4ik commented 9 months ago

Hi!

Recently I checked Profile-Guided Optimization (PGO) improvements on multiple projects. The results are here. E.g. PGO helps with optimizing Envoyproxy. PGO results for other proxies like HAProxy, Nginx, httpd you can be found in the repo above. According to the multiple tests, PGO can help with improving performance in many other cases. That's why I think trying to optimize g3 with PGO can be a good idea.

I can suggest the following action points:

Maybe testing Post-Link Optimization techniques (like LLVM BOLT) would be interesting too (Clang and Rustc already use BOLT as an addition to PGO) but I recommend starting from the usual PGO.

For the Rust projects, I recommend starting experimenting with PGO with cargo-pgo.

Here are some examples of how PGO optimization is integrated in other projects:

zh-jq-b commented 9 months ago

Thank you for bring this up.

PGO will be on our roadmap next year (2024).

There are some steps to do:

  1. Add testcases for profile purpose, may be based on the ones in scripts/coverage dir.
  2. Enable PGO for rust code, and do a benchmark test.
  3. Enable PGO when compile the vendored c source code such openssl or c-ares, then do a benchmark test.
  4. Add guides for users.