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

High increase of base memory usage by Router v1.46.0 #5163

Closed
juancarlosjr97 opened this issue May 14, 2024 · 2 comments · Fixed by #5180
Closed

High increase of base memory usage by Router v1.46.0 #5163

juancarlosjr97 opened this issue May 14, 2024 · 2 comments · Fixed by #5180

Comments

@juancarlosjr97
Copy link
Contributor

juancarlosjr97 commented May 14, 2024

The latest Router version v1.46.0 appears to be requiring high memory compared to previous versions.

To Reproduce

Steps to reproduce the behavior:

Version 1.46.0 - High Memory Usage

Brach with reproduction: https://github.com/juancarlosjr97/apollo-graphql-federation-memory-leak/tree/router-1.46.0

Note: This has been noticed in a Router running with enterprise features enabled, but the reproduction is using the router configuration without enterprise features enabled

  1. Pull the branch https://github.com/juancarlosjr97/apollo-graphql-federation-memory-leak/tree/router-1.46.0
  2. Run docker compose up
  3. Run docker stats
  4. Notice the baseline for the Router running the version 1.46.0 is around 190 MiB and 200 MiB
CONTAINER ID   NAME       CPU %     MEM USAGE / LIMIT   MEM %     NET I/O         BLOCK I/O   PIDS
3122400d15e3   subgraph   0.00%     69.68MiB / 512MiB   13.61%    2.55kB / 656B   0B / 0B     11
e1c9c6fc3a15   router     0.08%     194.7MiB / 512MiB   38.02%    2.26kB / 656B   0B / 0B     17

In the enterprise features enabled, the Router containers are between 210 and 200 MiB and on start up goes up to 260 MiB and then goes down and stable between 210 and 200 MiB.

Version v1.45.1 - Lower memory usage

  1. Pull the branch https://github.com/juancarlosjr97/apollo-graphql-federation-memory-leak/tree/router-1.45.1
  2. Run docker compose up
  3. Run docker stats
  4. Notice the baseline for the Router running the version 1.45.1 is around 90 MiB and 110 MiB
CONTAINER ID   NAME       CPU %     MEM USAGE / LIMIT   MEM %     NET I/O         BLOCK I/O   PIDS
3122400d15e3   subgraph   0.00%     71.9MiB / 512MiB    14.04%    2.33kB / 656B   0B / 0B     11
79d672c50e55   router     0.00%     99.39MiB / 512MiB   19.41%    2.06kB / 726B   0B / 0B     17

There is a minor increase also between version 1.44.0 and 1.45.1 from 32% to 40% utilization without any change in consumer traffic.

In the enterprise features enabled, the Router containers are between 90 and 110 MiB.

Expected behavior

Unclear if version 1.46.0 requires a high memory base from the release notes https://github.com/apollographql/router/releases/tag/v1.46.0 but the 1.46.0...1.45.1 enables serde in the parking_lot dependency
dependency the https://github.com/apollographql/router/blame/63e9fa287ba40c3dd94ea75dd5fdfe1795a75fd5/apollo-router/Cargo.toml#L246

Details of testing

  • Tested on Nomad Containers with enterprise features enabled
  • Tested locally with a Mac M1 running Docker
  • Versions affected: 1.46.0
  • Version Tested: 1.46.0, 1.45.1 and 1.44.0
@bnjjj
Copy link
Contributor

bnjjj commented May 14, 2024

Thanks for raising this issue. We also spotted that increase of base memory consumption and we already fixed it on dev #5061 the fix will be available in the next release.

@abernix abernix linked a pull request May 16, 2024 that will close this issue
@juancarlosjr97
Copy link
Contributor Author

The v1.47.0 not only fixed this issue but also decreased our steady memory usage by around 10% which is awesome! So, great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants