From 18eddab0e42866a1067849ee88db861e70f1b330 Mon Sep 17 00:00:00 2001 From: Alexander Zaitsev Date: Thu, 24 Aug 2023 03:46:57 +0200 Subject: [PATCH 1/2] docs: add PGO information --- .github/actions/spelling/allow.txt | 1 + .../{tuning.md => tuning/_index.md} | 4 +++ .../en/docs/administration/tuning/pgo.md | 31 +++++++++++++++++++ 3 files changed, 36 insertions(+) rename website/content/en/docs/administration/{tuning.md => tuning/_index.md} (93%) create mode 100644 website/content/en/docs/administration/tuning/pgo.md diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt index 2564c2cd006ae..a26c8c560906f 100644 --- a/.github/actions/spelling/allow.txt +++ b/.github/actions/spelling/allow.txt @@ -53,6 +53,7 @@ Enot Evercoss Explay FAQs +FDO FQDNs Fabro Figma diff --git a/website/content/en/docs/administration/tuning.md b/website/content/en/docs/administration/tuning/_index.md similarity index 93% rename from website/content/en/docs/administration/tuning.md rename to website/content/en/docs/administration/tuning/_index.md index fe92dae9c11db..836557b142088 100644 --- a/website/content/en/docs/administration/tuning.md +++ b/website/content/en/docs/administration/tuning/_index.md @@ -7,3 +7,7 @@ tags: ["tuning", "rust", "performance"] Vector is written in [Rust] and therefore doesn't include a runtime or a virtual machine. There are no special service-level steps you need to undertake to improve performance as Vector takes full advantage of all system resources by default and without any adjustments. [rust]: https://rust-lang.org + +## Pages + +{{< pages >}} diff --git a/website/content/en/docs/administration/tuning/pgo.md b/website/content/en/docs/administration/tuning/pgo.md new file mode 100644 index 0000000000000..218dfa0737507 --- /dev/null +++ b/website/content/en/docs/administration/tuning/pgo.md @@ -0,0 +1,31 @@ +--- +title: Profile-Guided Optimization +description: How to optimize Vector performance with Profile-Guided Optimization +short: PGO +weight: 3 +tags: ["pgo", "tuning", "rust", "performance"] +--- + +Profile-Guided Optimization (PGO) is a compiler optimization technique where a program is optimized based on the runtime profile. + +According to the [tests], we see improvements of up to 15% more processed log events per second on some Vector workloads. The performance benefits depend on your typical workload - you can get better or worse results. + +More information about PGO in Vector you can read in the corresponding GitHub [issue]. + +### How to build Vector with PGO? + +There are two major kinds of PGO: Instrumentation and Sampling (also known as AutoFDO). In this guide, is described the Instrumentation PGO with Vector. In this guide we use [cargo-pgo] for building Vector with PGO. + +* Install [cargo-pgo]. +* Check out Vector sources. +* Go to the Vector sources directory and run `cargo pgo build`. It will build the instrumented Vector version. +* Run instrumented Vector on your test load like `cargo pgo run -- -- -c vector.toml` and wait for some time to collect enough information from your workload. Usually, waiting several minutes is enough (but your case can be different). +* Stop Vector instance. The profile data will be generated in the `target/pgo-profiles` directory. +* Run `cargo pgo optimize`. It will build Vector with PGO optimization. + +A more detailed guide on how to apply PGO is in the Rust [documentation]. + +[tests]: https://github.com/vectordotdev/vector/issues/15631#issue-1502073978 +[issue]: https://github.com/vectordotdev/vector/issues/15631 +[documentation]: https://doc.rust-lang.org/rustc/profile-guided-optimization.html +[cargo-pgo]: https://github.com/Kobzol/cargo-pgo From 4cf4b208b2c8cb4f55c9ac71c15ee584af5ec828 Mon Sep 17 00:00:00 2001 From: Alexander Zaitsev Date: Thu, 24 Aug 2023 18:04:33 +0300 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Jesse Szwedko --- website/content/en/docs/administration/tuning/pgo.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/content/en/docs/administration/tuning/pgo.md b/website/content/en/docs/administration/tuning/pgo.md index 218dfa0737507..6018ea0e3b7e6 100644 --- a/website/content/en/docs/administration/tuning/pgo.md +++ b/website/content/en/docs/administration/tuning/pgo.md @@ -17,8 +17,8 @@ More information about PGO in Vector you can read in the corresponding GitHub [i There are two major kinds of PGO: Instrumentation and Sampling (also known as AutoFDO). In this guide, is described the Instrumentation PGO with Vector. In this guide we use [cargo-pgo] for building Vector with PGO. * Install [cargo-pgo]. -* Check out Vector sources. -* Go to the Vector sources directory and run `cargo pgo build`. It will build the instrumented Vector version. +* Check out the Vector repository. +* Go to the Vector source directory and run `cargo pgo build`. It will build the instrumented Vector version. * Run instrumented Vector on your test load like `cargo pgo run -- -- -c vector.toml` and wait for some time to collect enough information from your workload. Usually, waiting several minutes is enough (but your case can be different). * Stop Vector instance. The profile data will be generated in the `target/pgo-profiles` directory. * Run `cargo pgo optimize`. It will build Vector with PGO optimization.