Live data from Hacker News

Go ahead, self-host Postgres

pierce.dev

181–190 of 407 posts

Re: Go ahead, self-host Postgres

#181
(This is very reductionist)

A lot of this comes down to devs not understanding infrastructure and infrastructure components and the insane interplay and complexity. And they don't care! Apps, apps apps, developers, developers, developers!

On the managerial side, it's often about deflection of responsibility for the Big Boss.

It's not part of the app itself it can be HARD, and if you're not familiar with things, then it's also scary! What if you mess up?

(Most apps don't need the elasticity, or the bells and whistles, but you're paying for them even if you don't use them, indirectly.)

Re: Go ahead, self-host Postgres

#182

Self-hosting is more a question of responsibility I'd say. I am running a couple of SaaS products and self-host at much better performance at a fraction of the cost of running this on AWS. It's amazing and it works perfectly fine. For client projects, however, I always try and sell them on paying the AWS fees, simply because it shifts the responsibility of the hardware being "up" to someone else. It does not inherent…

> but it allows me to say, "we'll have to wait until they've sorted this out, Ikea and Disney are down, too."

From my experience your client’s clients don’t care about this when they’re still otherwise up.

Re: Go ahead, self-host Postgres

#183

What do you postgres self hosters use for performance analysis? Both GCP-SQL and RDS have their performance analysis pieces of the hosted DB and it's incredible. Probably my favorite reason for using them.

I’ve been very happy with Pganalyze.

Re: Go ahead, self-host Postgres

#184

Earlier quoted context omitted.

And on a similar naming note yet totally unrelated, check out k9s, which is a TUI for Kubernetes cluster admin. All kinds of nifty features built-in, and highly customizable.

If we're talking about CLIs, check out Kamal, the build system that 37signals / Basecamp / DHH developed, specifically to move off the cloud. I think it uses Kubernetes but not positive, it might just be Docker.

It's just Docker - it SSH's in to the target servers and runs `docker` commands as needed.

Re: Go ahead, self-host Postgres

#185

Earlier quoted context omitted.

For something like a database, what is the added advantage to using Kubernetes as opposed to something simple like Docker Compose?

Docker Compose (ignoring Swarm which seems to be obsolete) manages containers on a single machine. With Kubernetes, the pod that hosts the database is a pod like any other (I assume). It gets moved to a healthy machine when node goes bad, respects CPU/mem limits, works with generic monitoring tools, can be deployed from GitOps tools etc. All the k8s goodies apply.

When it comes to a DB moving the process around is easy, it's the data that matters. The reason bare-metal-hosted DBs are so fast is that they use direct-attach storage instead of networked storage. You lose those speed advantages if you move to distributed storage (Ceph/etc).

Re: Go ahead, self-host Postgres

#186

Earlier quoted context omitted.

100% certain because I started by self hosting before moving to AWS services for specific components and improved the uptime and reduced the time I spent keeping those services alive.

What was work you spend configuring those services and keeping them alive? I am genuinely curious... We have a very limited set of services, but most have been very painless to maintain.

A Django+Celery app behind Nginx back in the day. Most maintenance would be discovering a new failure mode:

- certificates not being renewed in time

- Celery eating up all RAM and having to be recycled

- RabbitMQ getting blocked requiring a forced restart

- random issues with Postgres that usually required a hard restart of PG (running low on RAM maybe?)

- configs having issues

- running out of inodes

- DNS not updating when upgrading to a new server (no CDN at the time)

- data centre going down, taking the provider’s email support with it (yes, really)

Bear in mind I’m going back a decade now, my memory is rusty. Each issue was solvable but each would happen at random and even mitigating them was time that I (a single dev) was not spending on new features or fixing bugs.

Re: Go ahead, self-host Postgres

#187

> Self-hosting a database sounds terrifying. Is this actually the "common" view (in this context)? I've got decades with databases so I cannot even begin to fathom where such an attitude would develop, but, is it? Boggling.

Over a decade of cloud provider propaganda achieves that. We appear to have lost the basic skill of operating a *nix machine, so anything even remotely close to that now sounds terrifying.

You mean you need to SSH into the box? Horrifying!

Re: Go ahead, self-host Postgres

#188

So, yeah, I guess there's much confusion about what a 'managed database' actually is ? Because for me, the table stakes are: -Backups: the provider will push a full generic disaster-recovery backup of my database to an off-provider location at least daily, without the need for a maintenance window -Optimization: index maintenance and storage optimization are performed automatically and transparently -Multi-datacenter…

Which providers do all of that?

I don't know which don't?

The default I've used on Amazon and GCP both do (RDS, Cloud SQL)

Re: Go ahead, self-host Postgres

#189
Enjoyed the article, and the "less can be more than you think" mindset in general.

To the author - on Android Chrome I seem to inevitably load the page scrolled to the bottom, footnotes area. Scrolling up, back button, click link again has the same results - I start out seeing footnotes. Might be worth a look.

Re: Go ahead, self-host Postgres

#190

Earlier quoted context omitted.

I have now switched to pglite for prototyping, because it lets me use all the postgres features.

Oho, what is this pglite that I have never heard of? I already like the sound of it.

`pglite` is a WASM version of postgres. I use it in one of my side projects for providing a postgres DB running in the user's browser.

For most purposes, it works perfectly fine, but with two main caveats:

1. It is single user, single connection (i.e. no MVCC) 2. It doesn't support all postgres extensions (particularly postGIS), though it does support pgvector

https://github.com/supabase-community/pg-gateway is something that may be used to use pglite for prototyping I guess, but I haven't used this.

Post reply on HN