R
Railwayβ€’15mo ago
ytsruh

Exponential Postgres Memory Usage?

Wanted to ask a quick question about Postgres plugins and memory usage. Over the past 23 days I've noticed memory usage increase almost exponentially. During that time, my application has had a very steady usage of about 65MB of memory usage (the project has the application & database only). Now my use case for Postgres is very specific.....every hour a few hundred (between 300-600) rows of data are added to a single table in Postgres. My gut is telling me that Postgres is simply keeping the 'newer' data available in memory hence the growth in memory. Can I assume that memory is uncapped in the Postgres plugin? If I'm right, is there anyway to cap it? or rebaseline the memory, would a restart of the database help for instance?
Solution:
databases get the same resources that your plan does 8vcpu and 8gb ram, and there's no way to cap it, you can restart to rebase the memory usage but that's only a temp fix because this would just happen again in the next 23 days
Jump to solution
14 Replies
Percy
Percyβ€’15mo ago
Project ID: 451fa1d0-fb81-42a8-a304-63d1fec478cb
ytsruh
ytsruhβ€’15mo ago
451fa1d0-fb81-42a8-a304-63d1fec478cb
Brody
Brodyβ€’15mo ago
I'm not sure if I'd trust the graph in the usage page, what does the plugin's metrics say about memory usage?
ytsruh
ytsruhβ€’15mo ago
Thanks for quick reply. Sadly it was telling the same story
Solution
Brody
Brodyβ€’15mo ago
databases get the same resources that your plan does 8vcpu and 8gb ram, and there's no way to cap it, you can restart to rebase the memory usage but that's only a temp fix because this would just happen again in the next 23 days
Brody
Brodyβ€’15mo ago
and you can't modify the postgres config file of the provided plugin to maybe change what postgres keeps in memory
ytsruh
ytsruhβ€’15mo ago
Ok brilliant thank you for the confirmation. My use case is quite unique. Its more akin to a no-SQL DB but sadly I do need the relational aspects as well. I'll do a restart for now and work on a solution
Brody
Brodyβ€’15mo ago
I see two options, switch to a neon.tech database, or wait until databases become just a service and a volume so that you'd be able to tweak the database config to your hearts content
ytsruh
ytsruhβ€’15mo ago
I actually tried Neon but the coldstarts were an absolute killer
Brody
Brodyβ€’15mo ago
ah right, then maybe the postgres hosting from vultr or digital ocean?
ytsruh
ytsruhβ€’15mo ago
Its cool, id rather spend money with Railway πŸ™‚ (I actually migrated from DO to Railway) I'll have a go at my own custom Postgres docker image where I can limit memory & settings etc. Thanks for the suggestions though, really helpful!
Brody
Brodyβ€’15mo ago
you could totally run your own custom postgres database, but there are some limitations to the current system that make it a little less than ideal like you'd only be able to access the database through the internal private network because railway doesn't support tcp proxying... yet
ytsruh
ytsruhβ€’15mo ago
I'm fine with that restriction actually but thanks for the heads up! Also....restart did rebase the memory so thanks again for that confirmation
Brody
Brodyβ€’15mo ago
no problems! πŸ™‚
Want results from more Discord servers?
Add your server