Skip to content

New production release#258

Merged
pjaspers merged 9 commits into
masterfrom
dev
Oct 9, 2021
Merged

New production release#258
pjaspers merged 9 commits into
masterfrom
dev

Conversation

@pjaspers
Copy link
Copy Markdown
Contributor

@pjaspers pjaspers commented Oct 9, 2021

Self proof reading checklist

  • Did I run Pronto and fixed all warnings (pronto run -c origin/dev)
  • Make sure all naming and code will remain understandable in 6 month by someone new to the project or by you.
  • Did I test the right thing?
  • Did I test corner cases, non happy path (defensive testing)?
  • Check that I used the ad-hoc patterns and created files accordingly (Presenters, Services, Search object, Form object,...)
  • Check code efficiency with record intensive project
  • Update documentation,readme accordingly

Thanks!

pjaspers and others added 9 commits October 8, 2021 11:39
They used to inherit their ENV variables, but in this newer version we
need to supply some defaults.
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
@pjaspers pjaspers merged commit 0281c2c into master Oct 9, 2021
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.

1 participant