Live data from Hacker News

Go ahead, self-host Postgres

pierce.dev

261–270 of 407 posts

Re: Go ahead, self-host Postgres

#261

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…

Me: “Why are we switching from NoNameCMS to Salesforce?” Savvy Manager: “NoNameCMS often won’t take our support calls, but if Salesforce goes down it’s in the WSJ the next day.”

This ignores the case when BigVendor is down for your account and your account only and support is mia, which is not that uncommon ime

Re: Go ahead, self-host Postgres

#262
Some fun math for you guys.

I had a single API endpoint performing ~178 Postgres SQL queries.

  Setup              Latency/query   Total time
  -------------------------------------------------
  Same geo area      35ms            6.2s
  Same local network 4ms             712ms
  Same server        ~0ms            170ms
This is with zero code changes, these time shavings are coming purely from network latency. A lot of devs lately are not even aware of latency costs coming from their service locations. It's crazy!

Re: Go ahead, self-host Postgres

#263

Earlier quoted context omitted.

> 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 is. You need to answer the question: what are the consecuences of your service being down for lets say 4 hours or some security patch isn't properly applied or you have not followed the best practices in terms of security? Many…

> Like everything, it is always cheaper to do it (it being cooking at home, cleaning your home, fixing your own car, etc) yourself (if you don't include the cost of your own time doing the service you normally pay someone else for). In a business context the "time is money" thing actually makes sense, because there's a reasonable likelihood that the business can put the time to a more profitable use in some other way…

Lol this made me laugh, there's a reasonable likelihood that time will be filled with meetings.

Re: Go ahead, self-host Postgres

#264
I've had my hair on fire because my app code shit the bed. I've never ever (throughout 15 years of using it in everything I do) had to even think about Postgres, and yes, I always set it up self-hosted. The only concern I've had is when I had to do migrations where I had to upgrade PG to fit with upgrades in the ORM database layer. Made for some interesting stepping-stone upgrades once in a while but mostly just careful sysadmining.

Re: Go ahead, self-host Postgres

#265

Earlier quoted context omitted.

I use Patroni for that in a k8s environment (although it works anywhere). I get an off-the-shelf declarative deployment of an HA postgres cluster with automatic failover with a little boiler-plate YAML. Patroni has been around for awhile. The database-as-a-service team where I work uses it under the hood. I used it to build database-as-a-service functionality on the infra platform team I was at prior to that. It's ba…

We use patroni and run it outside of k8s on prem, no issues in 6 or 7 years. Just upgraded from pg 12 to 17 with basically no down time without issue either.

Yo I'm curious if you have any pointers on how you went about this to share? Did you use their provided upgrade script or did you instrument the upgrade yourself "out of band"? rsync?

Currently scratching my head on what the appropriate upgrade procedure is for a non-k8s/operator spilo/patroni cluster for minimal downtime and risk. The script doesn't seem to work for this setup, erroring on mismatching PG_VERSION when attempting. If you don't mind sharing it would be very appreciated.

Re: Go ahead, self-host Postgres

#267

Earlier quoted context omitted.

Disks go bad. RAID is nontrivial to set up. Hetzner had a big DC outage that lead to data loss. Off site backups or replication would help, though not always trivial to fail over.

As someone who has set this up while not being a DBA or sysadmin. Replication and backups really aren’t that difficult to setup properly with something like Postgres. You can also expose metrics around this to setup alerting if replication lag goes beyond a threshold you set or a backup didn’t complete. You do need to periodically test your backups but that is also good practice. I am not saying something like RDS do…

I think the pricing of the big three is absurd, so I'm on your side in principle. However, it's the steady state that worries me. When the box has been running for 4 years and nobody who works there has any (recent) experience operating postgres anymore. That shit makes me nervous.

Re: Go ahead, self-host Postgres

#268

Earlier quoted context omitted.

| self hosting costs you between 30 and 120 minutes per month Can we honestly say that cloud services taking a half hour to two hours a month of someone's time on average is completely unheard of?

I handle our company's RDS instances, and probably spend closer to 2 hours a year than 2 hours a month over the last 8 years. It's definitely expensive, but it's not time-consuming.

Of course. But people also have high uptime servers with long-running processes they barely touch.

Re: Go ahead, self-host Postgres

#269

Earlier quoted context omitted.

> 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.

Yes but the fact that it's "not their fault" keeps the person from getting fired. Don't underestimate the power of CYA

[deleted]

Re: Go ahead, self-host Postgres

#270

> 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.

Can't agree more.
Post reply on HN