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

Add some performance optimizations #944

Merged
merged 9 commits into from
May 7, 2024
Merged

Add some performance optimizations #944

merged 9 commits into from
May 7, 2024

Conversation

Jake-Shadle
Copy link
Collaborator

This adds parallel options to improve deserialization speed of Endpoint, and Resource.

  1. Endpoint now has a from_proto and into_proto methods so that the current From impls continue to work as they do currently. This differences in these methods are that the protobufs now actually differentiate between ipv4/ipv6 and host, so we no longer need to parse a string in all cases, and instead just use a u32 for ipv4 and a pair of u64s for ipv6. This also saves on serialization though I'm not measuring that.
  2. Resource::Listener => Resource::FilterChain. This resource doesn't see as much traffic as Cluster, but it was still low hanging fruit. The envoy listener protobuf is massive overkill since we use literally 1 field from it, in addition to filter having more fields than we used, and also not enough.

quilkin/src/config.rs

Lines 824 to 825 in e44ca38

// TODO: keep the label across xDS
label: None,

  1. Cluster can now take advantage of the Endpoint optimizations to give pretty significant wins.
misc               fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ endpoint                      │               │               │               │         │
│  ├─ faster                     │               │               │               │         │
│  │  ├─ Ip        229.7 ns      │ 18.82 µs      │ 230.7 ns      │ 259.5 ns      │ 1000    │ 1000
│  │  │            1.775 GB/s    │ 17.84 MB/s    │ 1.56 GB/s     │ 1.475 GB/s    │         │
│  │  ╰─ Name      281.4 ns      │ 995.3 ns      │ 290.2 ns      │ 294.5 ns      │ 1000    │ 8000
│  │               2.216 GB/s    │ 618.8 MB/s    │ 2.149 GB/s    │ 2.111 GB/s    │         │
│  ╰─ slower                     │               │               │               │         │
│     ├─ Ip        289.7 ns      │ 6.812 µs      │ 310.7 ns      │ 322 ns        │ 1000    │ 1000
│     │            1.297 GB/s    │ 49.31 MB/s    │ 1.261 GB/s    │ 1.158 GB/s    │         │
│     ╰─ Name      351.6 ns      │ 1.102 µs      │ 364.1 ns      │ 366.5 ns      │ 1000    │ 8000
│                  1.729 GB/s    │ 551.2 MB/s    │ 1.669 GB/s    │ 1.653 GB/s    │         │
╰─ resource                      │               │               │               │         │
   ├─ faster                     │               │               │               │         │
   │  ├─ Cluster   2.518 ms      │ 4.482 ms      │ 3.01 ms       │ 3.019 ms      │ 1000    │ 1000
   │  │            799.1 MB/s    │ 449 MB/s      │ 668.6 MB/s    │ 666.6 MB/s    │         │
   │  ╰─ Listener  22.95 µs      │ 285.5 µs      │ 23.41 µs      │ 23.92 µs      │ 1000    │ 1000
   │               95.15 MB/s    │ 7.648 MB/s    │ 93.27 MB/s    │ 91.29 MB/s    │         │
   ╰─ slower                     │               │               │               │         │
      ├─ Cluster   3.475 ms      │ 5.588 ms      │ 3.589 ms      │ 3.602 ms      │ 1000    │ 1000
      │            586.3 MB/s    │ 364.5 MB/s    │ 567.6 MB/s    │ 565.5 MB/s    │         │
      ╰─ Listener  23.81 µs      │ 232.7 µs      │ 24.59 µs      │ 25.26 µs      │ 1000    │ 1000
                   90.02 MB/s    │ 9.212 MB/s    │ 87.16 MB/s    │ 84.87 MB/s    │         │

As noted, this doesn't actually change anything since these are backwards incompatible changes.

Copy link

github-actions bot commented May 7, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Copy link

github-actions bot commented May 7, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Copy link

github-actions bot commented May 7, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Copy link

github-actions bot commented May 7, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Copy link

github-actions bot commented May 7, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@XAMPPRocky XAMPPRocky enabled auto-merge (squash) May 7, 2024 17:43
@XAMPPRocky XAMPPRocky merged commit 64a0390 into main May 7, 2024
11 checks passed
@quilkin-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: 55e96159-a3a9-407c-81f3-549679cab690

The following development images have been built, and will exist for the next 30 days:

To build this version:

git fetch git@github.com:googleforgames/quilkin.git pull/944/head:pr_944 && git checkout pr_944
cargo build

@markmandel markmandel deleted the opt branch May 8, 2024 19:38
@markmandel markmandel added kind/feature New feature or request area/performance Anything to do with Quilkin being slow, or making it go faster. labels Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance Anything to do with Quilkin being slow, or making it go faster. kind/feature New feature or request size/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants