Postgram RAM consumption estimate
mathewcst
PROOP

6 months ago

Good afternoon, folks.

I race a TimescaleDB deployed on Railway for a small project related to a game I play. The gist of it is: every 6h we pull data from the official game API and store it in the database so we can serve history data.

So far, for the 6h pull interval, Postgres/Timescale is using around 2GB of memory. Since Railway charges per memory usage, that's around $25/m

Now the game has decreased the API interval to 1h, meaning at least 5x the time amount of pulls/inserts I would do in a day. I couldn't find a good estimate on how much that would increase in memory usage and, therefore, in cost.

Can someone help me calculate this? I don't want to spend much more than this only in database for this project, since it is a personal project that doesn't make any money back.

Any help is much appreciated.

Solved$20 Bounty

6 Replies

6 months ago

Hey!
This obviously will vary but a while ago I had a similar situation caching every other hour then reduced to hourly.
I found that my ram didnt scale that linearly with ingestion frequency. I think with some tuning you could get those numbers down,
https://stackoverflow.com/questions/55513214/timescaledb-memory-consumption-remains-very-low-even-when-there-is-a-lot-of-data

^Found this about tuning and usage.

I'd also suggest giving it a test on your own to validate! Up the frequency for a few hours and see the result in ram usage. Fairly confident you wont see a spike of 5xgrin emoji


mathewcst
PROOP

6 months ago

Thanks for the reply!

I've tuned a bit with timescaledb-tune (https://docs.tigerdata.com/self-hosted/latest/configuration/timescaledb-tune/) but I still want to have some sort of estimate on this, instead of just "try to tune and wait to see". The "wait to see" part can be expensive rofl emoji


mathewcst

Thanks for the reply!I've tuned a bit with timescaledb-tune (https://docs.tigerdata.com/self-hosted/latest/configuration/timescaledb-tune/) but I still want to have some sort of estimate on this, instead of just "try to tune and wait to see". The "wait to see" part can be expensive

6 months ago

Completely understand yeah. If I had to put a rough estimate on what you could be seeing I'd say ~2.1–3.0g at max, $21–$30/mo.


noahd

Completely understand yeah. If I had to put a rough estimate on what you could be seeing I'd say ~2.1–3.0g at max, $21–$30/mo.

6 months ago

Please note I cant give exact numbers as I do not have information on the intricacy of what's being done in those calls.


noahd

Completely understand yeah. If I had to put a rough estimate on what you could be seeing I'd say ~2.1–3.0g at max, $21–$30/mo.

mathewcst
PROOP

6 months ago

This actually aligns very close to what I came up with while researching myself and using AI for some estimations, which is within my budget. Ty so much for your help.


mathewcst

This actually aligns very close to what I came up with while researching myself and using AI for some estimations, which is within my budget. Ty so much for your help.

6 months ago

Happy to help!


Status changed to Solved noahd 6 months ago


Loading...