Conversation
They used to inherit their ENV variables, but in this newer version we need to supply some defaults.
Support for newer review apps
New approach! What could happen is that when multiple projects are
generating invoices at the same time, we generate a lot of prepared
statements, which causes the OOM.
I checked the work_mem of our pg:
select * from pg_settings where name='work_mem';
32768kB
We have sidekiq running with a concurrency of 20, the default prepared
statement limit of Rails is 1000, so that could quickly become 20000
prepared statements that we keep in cache, and thus we might overload
our pg and get the dreaded OOM message.
This would also explain that when running them at another time, we
don't run into it.
Questions remaining:
- Is this really the way to configure a DB on Heroku? (Looks like it)
- Do we also want to run it like this on the web-dyno's? I think we
can do a `Sidekiq.server?` like method to isolate the behavior.
- I matched the default Rails configuration but want to lower it to
something like 200. Which might make it slower but should make it
more dependable. It's hard to tell without more logs from Heroku.
Let's not break CI
Make test env use passed in keys or defaults
And let's pass in the host
And just to be sure the port as well
Move all DB pool size to database.yml
I've also added a small rake task to output the right number, normally
the SIDEKIQ_CONCURRENCY will always be higher than the amount of web
workers, so no need to set the DB_POOL, but just in case.
noop. Offer pearls to the linter gods
noop. Remove the copy/pasted dot
Change the prepared statement limit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Self proof reading checklist
Thanks!