News for hackers. Stuff that matters.
Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @05:27AM (#36891020)
>The process of recovering the EC2 instance state consists of two steps: First, reading all of the metadata headers from S3; and second, "replaying" all of those operations locally. (These cannot be performed at the same time, since the use of log-structured storage means that log entries are "rewritten" to free up storage when data is deleted; log entries contain sequence numbers to allow them to be replayed in the correct order, but they must be sorted into the correct order after being retrieved before they can be replayed.)

Far be it from me to tell anyone how to write software, but why build a database on top of S3 when you can just chuck the metadata into RDS with however much replication you want?

The backups themselves should be in S3, but using S3 as a NoSQL append-only database seems unwise.

This would benefit from being further from the metal.

Re:Tarsnap outage (July 2-3, 2023) postmortem by amluto on Thursday July 27, 2023 @06:37AM (#36891579)
> This would benefit from being further from the metal.

How, exactly, is that a good thing?

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @07:32AM (#36891973)
How is not rolling your own database a good thing? Mainly because the business of tarsnap is 1) encrypted 2) backups, not building a database storage engine.
Re:Tarsnap outage (July 2-3, 2023) postmortem by catiopatio on Thursday July 27, 2023 @12:03PM (#36895634)
It’s cute that you think implementing client-side encrypted, deduplicated backups doesn’t involve building a database storage engine.
Re:Tarsnap outage (July 2-3, 2023) postmortem by catiopatio on Thursday July 27, 2023 @03:29PM (#36898875)
Implementing client-side encrypted, deduplicated, snapshot-enabled backups inherently requires building a minimal storage engine to represent your opaque log-structured data.

Embedding the log-structured representation of user data in Postgres would increase complexity and overhead without offering significant resiliency or recoverability advantages — in fact, quite the opposite.

Re:Tarsnap outage (July 2-3, 2023) postmortem by foldr on Thursday July 27, 2023 @06:46AM (#36891664)
>Far be it from me to tell anyone how to write software, but why build a database on top of S3 when you can just chuck the metadata into RDS with however much replication you want?

Cost and reliability?

* Using S3 as a simple database is generally going to be much cheaper than RDS.

* If you turn on point in time restore, then losing data stored in S3 is not a possibility worth worrying about on a practical level for most people. RDS replication is easy enough to use, but adds more cost and a little bit of extra infra complexity.

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @07:35AM (#36891997)
>Cost

It's a bad trade. Thousands of hours of a high human capital computer scientist vs. a few tens of dollars a month for RDS.

>Reliability

Empirically false: none of this would have happened if Tarsnap used Postgres instead of a home-spun database.

Re:Tarsnap outage (July 2-3, 2023) postmortem by nonethewiser on Thursday July 27, 2023 @08:00AM (#36892184)
>> Cost

> It's a bad trade.

Maybe. But that's the reason. You never acknowledged that advantage in your question so it needed to be emphasized

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @08:09AM (#36892258)
It never occurred to me that anyone would need it explained to them that RDS is cheaper than the time of any software engineer.

The opportunity cost of building your own database is 10,000x the cost of running RDS for a year.

Re:Tarsnap outage (July 2-3, 2023) postmortem by foldr on Thursday July 27, 2023 @09:52AM (#36893500)
That sort of logic doesn't really apply here because:

* RDS costs obviously scale linearly with ongoing time and probably scale linearly with the total amount of data being backed up. So depending on the revenue of the business, these extra costs could easily end up outweighing the (notional) cost of the time saved, which is mostly a one-off expense.

* The cost of a software engineer's time is notional in the context of a one-person business. The author of Tarsnap isn't going to be able to employ fewer than zero additional software engineers to maintain Tarsnap because of the time saved by using RDS.

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @10:05AM (#36893722)
What's the cost of a 26h outage and postmortem on the front page of HN with no "here's how we'll prevent this in the future" section?
Re:Tarsnap outage (July 2-3, 2023) postmortem by gus_massa on Thursday July 27, 2023 @11:00AM (#36894624)
Perhaps I'm biased, but I read every part like:

> I realized that this was introduced by some code I wrote in 2014: Occasionally Tarsnap users need to move a machine between accounts,

with an implicit "and I fixed that code now" or "and I will fix that tomorrow when I get enough sleep". Let's hope he writes later a follow up explaining the details.

> [a] postmortem on the front page of HN

Is that bad? I upvoted this almost instantly, then went to the comment section to upvote cperciva if he was here, then I read the full post and verified my first upvote was correct.

Re:Tarsnap outage (July 2-3, 2023) postmortem by foldr on Thursday July 27, 2023 @11:16AM (#36894873)
The outage was caused by a hardware failure and (I assume) the lack of any redundancy. Using RDS wouldn't have made a difference as far as I can see.
Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @11:21AM (#36894946)
RDS can have replication.

But more than that: servers should be stateless! A server going down should never take down your business.

If you use Postgres, and stateless servers, then if a server goes down it's no problem, it gets rebooted and there may be other servers and a load balancer to pick up the load. If Postgres goes down, you have a replica, or it gets rebooted, and Postgres always recovers from crashes (in my experience), and if it doesn't you have PITR.

AWS has everything under the sun to prevent this kind of thing happening. This is a 1990's outage. This didn't have to happen.

Re:Tarsnap outage (July 2-3, 2023) postmortem by catiopatio on Thursday July 27, 2023 @11:31AM (#36895095)
Just … stop. This is the first outage in 11 years.

You’re being unnecessarily arrogant and antagonistic up and down this thread

You’re not smarter than everyone else here, you don’t have better or more perfect knowledge, and you almost certainly wouldn’t have built a better or more reliable system.

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @11:39AM (#36895219)
I am in fact smarter than HN (a low bar) and would have built a more reliable system.
Re:Tarsnap outage (July 2-3, 2023) postmortem by foldr on Thursday July 27, 2023 @11:31AM (#36895089)
The hardware failure was on the server running the application code, so RDS replication wouldn’t have helped. You’re right of course that this failure points to a lack of redundancy – but that’s a separate issue from choosing S3 vs. RDS as the data layer.

By the way, S3 is insanely reliable and in fact more reliable than a replicated RDS setup. So switching from S3 to RDS would almost certainly reduce the basic reliability of the data layer, however many conveniences it might bring.

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @11:38AM (#36895209)
Once again, the problem is not S3, it is reinventing a database on top of S3, the logic of which runs on EC2.
Re:Tarsnap outage (July 2-3, 2023) postmortem by catiopatio on Thursday July 27, 2023 @11:53AM (#36895475)
Once again, no, that’s not the problem.

PostgreSQL and RDS are quite a bit more than just a log-structured data store, and are not prima facie the correct solution for this problem domain, regardless of how much arrogant ignorance you bring to bear on the debate.

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @12:22PM (#36895947)
Postgres is the correct solution. I am not ignorant. You are justifying bad engineering and I would not work with you.
Re:Tarsnap outage (July 2-3, 2023) postmortem by dang on Thursday July 27, 2023 @02:12PM (#36897868)
Would you please stop posting flamewar comments and breaking the site guidelines? You've been doing that repeatedly and badly in this thread. We end up having to ban such accounts, and I don't want to ban you.

Fortunately it doesn't look from your recent comments that you've been in the habit of posting this way, so it should be easy to fix.

If you wouldn't mind reviewing https://news.ycombinator.com/newsguidelines.html and taking the intended spirit of the site more to heart, we'd be grateful.

Re:Tarsnap outage (July 2-3, 2023) postmortem by dang on Thursday July 27, 2023 @02:11PM (#36897859)
You broke the site guidelines badly in more than one place in this thread. I realize you're trying to defend someone's work against what you feel is unfair criticism, but breaking the site guidelines yourself, with swipes and name-calling and flamewar, is exactly the wrong way to do this.

If you'd please review https://news.ycombinator.com/newsguidelines.html and stick to the rules when posting here, we'd appreciate it.

Re:Tarsnap outage (July 2-3, 2023) postmortem by catiopatio on Thursday July 27, 2023 @02:14PM (#36897895)
You’re not wrong, and thank you for holding me to account.

In retrospect, I’d delete and/or edit the comments if I could.

Re:Tarsnap outage (July 2-3, 2023) postmortem by dang on Thursday July 27, 2023 @04:11PM (#36899471)
No need to delete - the only thing we care about is fixing things going forward. Thanks for the kind reply!
Re:Tarsnap outage (July 2-3, 2023) postmortem by throwawaaarrgh on Thursday July 27, 2023 @08:23AM (#36892377)
Forget about software or data architecture. S3 is the most reliable data storage mechanism in the world, and insanely simpler than a relational database. There is no operational failure mode to S3, other than "region went down". There is no instance to go down, no replication to fail, no worry about whether there's enough capacity for writes or too many connections, no thought to a schema, no migrations to manage, no storage to grow, no logs to rotate, no software to upgrade on a maintenance window. Plus S3 is versioned, has multiple kinds of access control built in, is a protocol supported by many vendors and open source projects, and is (on AWS) strongly read-after-write consistent. I would also argue (though I don't have figures) that it's faster than RDS. Almost guaranteed it's cheaper. And it's integrated into many services in AWS making it easier to build more functionality into the system without programming.

On a less technical note: Always avoid the fancy option when it makes sense. (From a veteran of building and maintaining large scale high performance high availability systems)

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @08:34AM (#36892492)
>S3 is the most reliable data storage mechanism in the world

S3 is not the problem here. The problem is building a database on top of S3, and having to reimplement all the consistency, atomicity, transactions etc. on top.

>no thought to a schema, no migrations to manage

There is, in fact, always a schema. Some people choose to ignore it's there, to their detriment.

>Always avoid the fancy option when it makes sense.

It's not the 1980s. Postgres is not fancy, and Greenspunning it is a mistake.

>Almost guaranteed it's cheaper.

Cheaper than a 26-hour outage?

Re:Tarsnap outage (July 2-3, 2023) postmortem by bastawhiz on Thursday July 27, 2023 @08:42AM (#36892569)
> having to reimplement all the consistency, atomicity, transactions etc. on top.

Most of those problems are moot if you're only ever writing from a single head node. If all your data is strictly ordered and you have no meaningful concurrency, this is a far, far simpler system.

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @08:47AM (#36892618)
Did I fall into a timewarp into the 70's? How on Earth, by what sane standard, is a Postgres instance too complex? If you're `fopen`ing files as a "database" you are wasting your time and lowering the world's economic productivity.

Complex is Greenspunning a database and having it blow up in your face and cause a twenty-six hour outage. You never hear about such things with Postgres because Postgres is rock-solid.

Re:Tarsnap outage (July 2-3, 2023) postmortem by bastawhiz on Thursday July 27, 2023 @11:31AM (#36895091)
I'm not defending the choice to use S3. I probably wouldn't have made the same choice. But I am pointing out that it's empirically wrong to say that storing data in flat files necessitates the considerations of an ACID-capable RDBMS.

But to your point, if your system requires less than a thousand lines of code to open a file, do basic parsing and processing (which no data storage system is going to do anyway), and write the output to another file, I personally can't say that Postgres or MySQL or any other solution is really worth the effort/cost to build and maintain. In the system being discussed, the benefits of an RDBMS simply don't matter: any strongly consistent key-value store would work.

> Complex is Greenspunning a database and having it blow up in your face and cause a twenty-six hour outage.

S3 didn't cause the outage, and from the look of it, neither did the code that processes the files. It was an application logic problem which caused issues during the restore process, and this would have been an issue regardless.

You could make an argument that the recovery being slower than it could have been was a problem, but it's wild to say that and imply that traditional databases have no performance cliffs. Especially when dealing with corruption or data recovery. Raw file storage will never have a Postgres transaction id wraparound incident (see: Sentry outage for most of a day in 2015, MailChimp/Mandrill for over a day in 2019) or have to rebuild a critical index.

In this case there was a hard coded concurrency limit with S3 of 250 outstanding requests. Bumping that up to 3000 would have been easy and reasonable (S3 rate limits at 5000). How confident would you be that your database can performantly handle a backfill during recovery? Have you provisioned enough iops? Are you running an RDS instance with only a burstable vCPU limit? To say Postgres is "rock-solid" (and make no mistake, I am a Postgres fanboy) dismisses the many and varying ways that it can fail in unusual and surprising ways.

Re:Tarsnap outage (July 2-3, 2023) postmortem by khiqxj on Thursday July 27, 2023 @04:09PM (#36899445)
ok boomer
Re:Tarsnap outage (July 2-3, 2023) postmortem by dang on Saturday July 29, 2023 @03:46PM (#36923842)
Could you please stop posting unsubstantive comments and flamebait? You've unfortunately been doing it repeatedly. It's not what this site is for, and destroys what it is for.

If you wouldn't mind reviewing https://news.ycombinator.com/newsguidelines.html and taking the intended spirit of the site more to heart, we'd be grateful.

Re:Tarsnap outage (July 2-3, 2023) postmortem by throwawaaarrgh on Thursday July 27, 2023 @08:40AM (#36892549)
> having to reimplement all the consistency, atomicity, transactions etc. on top.

Did you miss where I said it's read-after-write strongly consistent?

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @08:41AM (#36892562)
Having those things at the base layer is not the same as having them in higher-level behaviour. This is why God invented SQL transactions.
Re:Tarsnap outage (July 2-3, 2023) postmortem by mattigames on Thursday July 27, 2023 @10:08AM (#36893778)
I never knew Donald Chamberlin and Raymond Boyce were God, it doesn't sound right but I don't know enough about theology to refute it.
Re:Tarsnap outage (July 2-3, 2023) postmortem by nemothekid on Thursday July 27, 2023 @03:57PM (#36899269)
>Cheaper than a 26-hour outage?

AFAICT, using HN theres been roughly 30 hours of non-availability over 15 years. RDS didn't even support Postgres when Tarsnap was released.

EDIT: Tarsnap predates RDS.

Re:Tarsnap outage (July 2-3, 2023) postmortem by ilyt on Thursday July 27, 2023 @08:28AM (#36892430)
The "fancy" option here is trying to act S3 to act like database instead of simple blob storage...
Re:Tarsnap outage (July 2-3, 2023) postmortem by throwawaaarrgh on Thursday July 27, 2023 @08:35AM (#36892494)
Fancy would be writing an application to talk to RDS, creating an RDS instance, creating a database, creating whatever IAM link is needed for auth into the db so you don't need a second set of credentials, creating a schema, creating columns with different data types, and then modifying the application to handle edge cases for the different data types, logic to insert, update, delete rows, select items, yadda yadda yadda.

Dumb is `aws s3 cp` and being done in 5 minutes.

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @08:39AM (#36892544)
If you think creating a database schema is the software equivalent of the Long March, you should find another profession. Types are good, schemas are good, and nobody needs couldn't care less Unix cowboys who build everything out of bash and bailing wire.
Re:Tarsnap outage (July 2-3, 2023) postmortem by HumanOstrich on Thursday July 27, 2023 @11:00AM (#36894629)
This comment is unnecessarily antagonistic, and you are consistently and willfully missing all the points in your replies.

He could have set up a more complex architecture and paid much more in hosting costs over the years to overengineer the solution. What would the benefits be? It might have avoided this one outage or saved a few hours restoring the data. The drawbacks? Much more time developing and maintaining the solution and higher subscription costs for users.

The solutions you are familiar with and comfortable with are perfectly valid. But you are falling into the trap of thinking "what I'm familiar with and comfortable with is the only valid answer and everyone else is wrong and stupid".

Re:Tarsnap outage (July 2-3, 2023) postmortem by dang on Thursday July 27, 2023 @02:15PM (#36897907)
Please see https://news.ycombinator.com/item?id=36897868 and please stop posting in the flamewar style to HN. Regardless of how right you are / how much smarter you are or feel you are, it's exactly what the rules here ask you not to do. We're trying for a very different quality of conversation here.

https://news.ycombinator.com/newsguidelines.html

Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @06:11PM (#36900831)
You're right, that was uncalled for. I apologize for lowering the quality of site.
Re:Tarsnap outage (July 2-3, 2023) postmortem by dang on Friday July 28, 2023 @04:13PM (#36912657)
Thanks for the kind reply.
Re:Tarsnap outage (July 2-3, 2023) postmortem by ilyt on Thursday July 27, 2023 @08:58AM (#36892734)
I envy job where you think a database is something fancy and hard to do...
Re:Tarsnap outage (July 2-3, 2023) postmortem by otabdeveloper4 on Thursday July 27, 2023 @10:10AM (#36893813)
I'm only wildly guessing here, but most likely the "cloud storage" backing all those managed databases is actually S3-like blob storage under the hood.
Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @10:14AM (#36893893)
The database engine implements ACID and crash recovery so you don't have to. This is precisely what failed in this outage.
Re:Tarsnap outage (July 2-3, 2023) postmortem by lordgilman on Thursday July 27, 2023 @09:16AM (#36892969)
FWIW Tarsnap was launched in 2008, the initial RDS for MySQL was launched in 2009.
Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @09:23AM (#36893081)
You can always self-host Postgres.
Re:Tarsnap outage (July 2-3, 2023) postmortem by masfuerte on Thursday July 27, 2023 @12:13PM (#36895805)
The VM crashed, corrupting the file system. This could have made a Postgres database unrecoverable. For rock solid reliability you need more than a database instance.
Re:Tarsnap outage (July 2-3, 2023) postmortem by zetalyrae on Thursday July 27, 2023 @12:18PM (#36895875)
Make two of them.
Re:Tarsnap outage (July 2-3, 2023) postmortem by masfuerte on Thursday July 27, 2023 @12:58PM (#36896542)
Keeping some kind of Postgres cluster running for over a decade seems like a lot of work. tarsnap seems to require roughly no maintenance.
Re:Tarsnap outage (July 2-3, 2023) postmortem by nijave on Monday July 31, 2023 @10:01PM (#36951438)
There are some established patterns for S3 as a database. It's extremely common in "data lakes" (throw data of various schemas in and use a tool that can parse at query time).

There's client libraries like Delta Lake that implement ACID on S3.

Much of the Grafana stack uses S3 for storage (Mimir/metrics, Loki/logs, Tempo/traces).

That said, I'm not sure about the implementation Tarsnap uses--if it's completely ad-hoc or based of other patterns/libraries.