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

feat: add kong config with nginx_worker_processes option #1271

Merged
merged 2 commits into from
Jul 2, 2023

Conversation

Wakeful-Cloud
Copy link
Contributor

What kind of change does this PR introduce?

This PR adds the ability to configure Kong's nginx_worker_processes value via the below TOML config:

[kong]
# Number of Nginx workers. Set this to 1 to minimize memory usage.
nginx_worker_processes = 1

What is the current behavior?

When running in memory-constrained environments, Kong/Nginx may spawn an excessive number of workers, drastically increasing memory usage.

What is the new behavior?

This PR allows users to fine-tune the number of Kong/Nginx worker processes when desired. If no configuration is provided, the previous behavior (auto) is used.

Additional context

For my use case, this allowed me to cut memory usage of the entire Supabase Docker compose by 79%! (1487 MiB -> 312 MiB) by setting it to just 1 (I'm not especially concerned about the reduced routing performance).

@Wakeful-Cloud Wakeful-Cloud requested a review from a team as a code owner July 1, 2023 21:26
@coveralls
Copy link

coveralls commented Jul 1, 2023

Pull Request Test Coverage Report for Build 5434097181

  • 16 of 16 (100.0%) changed or added relevant lines in 1 file are covered.
  • 7 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 62.014%

Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 7 7.94%
Totals Coverage Status
Change from base Build 5431792736: -0.04%
Covered Lines: 4674
Relevant Lines: 7537

💛 - Coveralls

@sweatybridge sweatybridge changed the title Add Kong nginx_worker_processes option fix: add kong config with nginx_worker_processes option Jul 2, 2023
Copy link
Contributor

@sweatybridge sweatybridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great change! I think it's safe to default to 1 for local development.

@sweatybridge sweatybridge changed the title fix: add kong config with nginx_worker_processes option feat: add kong config with nginx_worker_processes option Jul 2, 2023
@sweatybridge sweatybridge enabled auto-merge (squash) July 2, 2023 01:45
@sweatybridge sweatybridge merged commit a0a98d8 into supabase:main Jul 2, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants