NeonN
Neon2y ago
5 replies
popular-magenta

Increased memory usage in Elixir/Phoenix app when following Neon.tech guide.

Hello,
I've noticed a significant (~200mb) increase in BEAM virtual machine ram usage (the heap, specifically) when following this guide: https://neon.tech/docs/guides/elixir-ecto

Previous to this updated guide, I believe the instructions were similar to the following:

config :app, App.Repo,
  ssl: true,
  ssl_opts: [
    server_name_indication: 'some-example.us-east-1.aws.neon.tech',
    verify: :verify_none
  ]


This worked fine and I had no issues. Recently the guide has been updated as Postgrex 0.18 supports verifying the SSL certificate and your instructions now provide the following:

config :app, App.repo,
  ssl: [cacerts: :public_key.cacerts_get()]


This is cleaner and preferred. The problem however is a seemingly large jump in ram usage. With the previous setup, my almost barebones Phoenix app is using only 74mb of ram according to the OTP Observer with 10 DBConnection processes. If I keep everything the same and switch to the new method, my ram usage jumps to ~254mb. I realize this is most likely not a you problem and I should file something with the Postgrex/Ecto repos but wanted to ask the following:

1) Have you heard reports of this or seen this occurring?
2) Is there a simple fix to this that I've missed?

I find it odd that this small change would drastically effect ram usage so much... I can't even start a simple app on Fly.io's 512mb machines anymore without going OOM unless I fallback to the older :verify_none guide.
Neon
This guide describes how to connect from an Elixir application with Ecto, which is a database wrapper and query generator for Elixir. Ecto provides an API and abstractions for interacting databases, e...
Connect from Elixir with Ecto to Neon - Neon Docs
Was this page helpful?