R
Railwayβ€’17mo 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β€’17mo ago
Project ID: 451fa1d0-fb81-42a8-a304-63d1fec478cb
ytsruh
ytsruhOPβ€’17mo ago
451fa1d0-fb81-42a8-a304-63d1fec478cb
Brody
Brodyβ€’17mo 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
ytsruhOPβ€’17mo ago
Thanks for quick reply. Sadly it was telling the same story
Solution
Brody
Brodyβ€’17mo 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β€’17mo ago
and you can't modify the postgres config file of the provided plugin to maybe change what postgres keeps in memory
ytsruh
ytsruhOPβ€’17mo 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β€’17mo 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
ytsruhOPβ€’17mo ago
I actually tried Neon but the coldstarts were an absolute killer
Brody
Brodyβ€’17mo ago
ah right, then maybe the postgres hosting from vultr or digital ocean?
ytsruh
ytsruhOPβ€’17mo 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β€’17mo 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
ytsruhOPβ€’17mo 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β€’17mo ago
no problems! πŸ™‚
Want results from more Discord servers?
Add your server