Skip to content

Commit

Permalink
docs: add PGO information (#18369)
Browse files Browse the repository at this point in the history
* docs: add PGO information

* Apply suggestions from code review

Co-authored-by: Jesse Szwedko <jesse@szwedko.me>

---------

Co-authored-by: Jesse Szwedko <jesse@szwedko.me>
  • Loading branch information
zamazan4ik and jszwedko authored Aug 24, 2023
1 parent 2aaea89 commit eac3cd0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Enot
Evercoss
Explay
FAQs
FDO
FQDNs
Fabro
Figma
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 >}}
31 changes: 31 additions & 0 deletions website/content/en/docs/administration/tuning/pgo.md
Original file line number Diff line number Diff line change
@@ -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 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.

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

0 comments on commit eac3cd0

Please sign in to comment.