Managed postgres vs docker postgres performance
nikolandgraf
PROOP

2 months ago

Are there any performance benefits selecting a postgres database vs deploying a postgres from a docker image on railway?

I have deployed the gel database template on railway and seeing degraded performance compared to the geldata cloud (which is hosted by gel).

Wondering if I should rather select a postgres database on railway and host a gel server next to it, if that would boost performance.

$30 Bounty

11 Replies

Railway
BOT

2 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


It really depends on your use case. For most apps, using Postgres in Railway will be good enough in terms of performance.

However, there are other implications running on Railway (self-managed) vs any other managed database and it's that you must take care of it. If you want to backup or upgrade versions, you'll need to do it yourself. There are a couple templates to make this less complicated like https://github.com/railwayapp-templates/postgres-s3-backups but still doing a recovery would be manual work.

If you feel comfortable doing that, then I suspect hosting on Railway would be more cost-effective and performant enough.

If you host the Gel server next to the Postgres, it will be more performant than running the server at a different place (esp. if not same region) so you can try that out.


crisog

It really depends on your use case. For most apps, using Postgres in Railway will be good enough in terms of performance.However, there are other implications running on Railway (self-managed) vs any other managed database and it's that you must take care of it. If you want to backup or upgrade versions, you'll need to do it yourself. There are a couple templates to make this less complicated like https://github.com/railwayapp-templates/postgres-s3-backups but still doing a recovery would be manual work.If you feel comfortable doing that, then I suspect hosting on Railway would be more cost-effective and performant enough.If you host the Gel server next to the Postgres, it will be more performant than running the server at a different place (esp. if not same region) so you can try that out.

nikolandgraf
PROOP

2 months ago

Okay. Im fine with upgrading myself.
I am just a bit surprised to see the startup times of queries 4x slower on railway compared to the gel cloud. Even though on railway i have way more resources. Configs are exactly the same on both instances


irazvan2745
PRO

2 months ago

Railway doesn’t offer managed Postgres, the database thing is just a “template loader”


irazvan2745
PRO

2 months ago

Also make sure the db and gel are in the same instance


nikolandgraf
PROOP

2 months ago

Yes I think they are - I have used the gel railway template which uses gel docker image


irazvan2745
PRO

2 months ago

Check if they are


nikolandgraf

Yes I think they are - I have used the gel railway template which uses gel docker image

I'll try this myself and report back


nikolandgraf

Yes I think they are - I have used the gel railway template which uses gel docker image

I managed to deploy this with an standalone PostgreSQL server + Gel container. Please try it and let me know if you see any performance improvements.
https://railway.com/deploy/gel-postgresql

You can also tweak GEL_SERVER_MAX_BACKEND_CONNECTIONS and GEL_SERVER_COMPILER_POOL_MODE to improve performance. Related docs,
https://docs.geldata.com/reference/running/configuration#gel-server-compiler-pool-mode
https://docs.geldata.com/reference/running/configuration#gel-server-max-backend-connections


nikolandgraf
PROOP

2 months ago

Alright - deploying the postgres as a separate service next to the gel server made all the difference!
Now performance looks roughly equal.

So would not recommend to use this template here: https://railway.com/deploy/3tpcCB


nikolandgraf

Alright - deploying the postgres as a separate service next to the gel server made all the difference! Now performance looks roughly equal. So would not recommend to use this template here: https://railway.com/deploy/3tpcCB

Glad to hear it's working better now!

If you ever need more help don't hesitate to ask 🫡


Loading...