Live data from Hacker News

Ask HN: How much traffic do you serve and with which database engine?

news.ycombinator.com

21–30 of 39 posts

Re: Ask HN: How much traffic do you serve and with which database engine?

#21

Let's do some math. First, the IOT devices reporting daily. In the absence of further context, I’m going to assume that it doesn’t matter when the devices report, so they can be configured to spread out their load. I’m also going to assume 1kb of data per device, but with an HTTPS API there’s roughly 7kb of overhead that we need to account for when calculating bandwidth. (Source: http://netsekure.org/2010/03/tls-over…

This is a nice analysis of incoming and outgoing bandwidth, but totally neglects to analyze the compute power required by each query. You can’t answer that without knowing the possible queries that users can send. Do they have a dashboard with a known set of queries? Do they have a GraphQL API that can produce pathological queries? Can they send SQL directly? Are they running aggregations? Do they use filters? Are they querying recent data or all historical data?

And that’s just the read side. You also need to ask about ingestion and transformation. Is the database storing raw events and nothing else? (Is the user happy with that?) Is it append only? Is it being rolled up and summarized into daily partitions? How many transactions per second? How many of those are INSERT vs. UPDATE or DELETE? Which rows are being updated? Only recent or any of them? All of them?

etc…

There is no generic answer to this question, and “requests per second” is a reductive and insufficient interpretation of the problem that won’t identify any of the hidden complexity.

Re: Ask HN: How much traffic do you serve and with which database engine?

#22
post #2

I think you might be asking the wrong questions. They key questions are Queries per second and the median response size of the query. For example at reddit (15 years ago) we had 10x more vote traffic than comment traffic, but we only needed two databases to handle votes (technically only one the other was just for redundancy). But we needed nine comments databases. Mainly because the median query response was so much…

Unrelated: I love HN; a random database question and fkn jedberg is one of the first responders

Who is he?

Re: Ask HN: How much traffic do you serve and with which database engine?

#23
post #18
post #2

I think you might be asking the wrong questions. They key questions are Queries per second and the median response size of the query. For example at reddit (15 years ago) we had 10x more vote traffic than comment traffic, but we only needed two databases to handle votes (technically only one the other was just for redundancy). But we needed nine comments databases. Mainly because the median query response was so much…

Thank you very much! Did you start with separate databases or wait until you needed to scale workloads separately before breaking things up?

I imagine they didn't optimize prematurely.

Re: Ask HN: How much traffic do you serve and with which database engine?

#24

Let's do some math. First, the IOT devices reporting daily. In the absence of further context, I’m going to assume that it doesn’t matter when the devices report, so they can be configured to spread out their load. I’m also going to assume 1kb of data per device, but with an HTTPS API there’s roughly 7kb of overhead that we need to account for when calculating bandwidth. (Source: http://netsekure.org/2010/03/tls-over…

This is a nice analysis of incoming and outgoing bandwidth, but totally neglects to analyze the compute power required by each query. You can’t answer that without knowing the possible queries that users can send. Do they have a dashboard with a known set of queries? Do they have a GraphQL API that can produce pathological queries? Can they send SQL directly? Are they running aggregations? Do they use filters? Are th…

The OP doesn’t give any hints as to what users are doing, so as I said I just assumed “last 90 days of data” was the only query they’d make, but it’s a fair point that that caused me to leave out CPU power since it’s basically negligible for just shoveling data off of a disk.

Thanks for expanding on my comments about how important actually having detailed requirements is for doing performance calculations!

Re: Ask HN: How much traffic do you serve and with which database engine?

#25

Earlier quoted context omitted.

This is a nice analysis of incoming and outgoing bandwidth, but totally neglects to analyze the compute power required by each query. You can’t answer that without knowing the possible queries that users can send. Do they have a dashboard with a known set of queries? Do they have a GraphQL API that can produce pathological queries? Can they send SQL directly? Are they running aggregations? Do they use filters? Are th…

The OP doesn’t give any hints as to what users are doing, so as I said I just assumed “last 90 days of data” was the only query they’d make, but it’s a fair point that that caused me to leave out CPU power since it’s basically negligible for just shoveling data off of a disk. Thanks for expanding on my comments about how important actually having detailed requirements is for doing performance calculations!

Yes indeed, OP only asked “how much traffic is required,” which could be zero if his database is locked while trying to respond to some absurd query from one of his users :)

Re: Ask HN: How much traffic do you serve and with which database engine?

#26
post #22

Earlier quoted context omitted.

Unrelated: I love HN; a random database question and fkn jedberg is one of the first responders

Who is he?

Apparently the first paid employee of reddit https://www.jedberg.net

Re: Ask HN: How much traffic do you serve and with which database engine?

#27
post #22

Earlier quoted context omitted.

Unrelated: I love HN; a random database question and fkn jedberg is one of the first responders

Who is he?

jedberg.net https://www.jedberg.net I was the first (paid) employee of reddit, and currently run Site Reliability at Netflix.

Re: Ask HN: How much traffic do you serve and with which database engine?

#28
With any database architecture the goal is to ensure that nothing hits your database if you can help it.

We served 13 billion requests last year, according to fastly, and burned 3.84PB of data.

Each one of those requests will generate a bunch of metrics, depending on what's happening.

To back that we have an Aurora db.r6g.large, which we've been using for a few years now. We just redid the metrics, so the CPU is now running at about 40% (it was at like 6% for a few years). Basically instead of aggregating metrics we moved to basically a time-series sort of structure.

The reason we can do that is simple: because we have no realtime requirement, we push all the requests through fastly, which pushes the logs to s3. Fastly uploads the logs to s3 every few minutes, and there's a lambda that chews through the logs whenever they show up. Usually there are like 10-15 of them running at a given time.

So really, by removing the realtime requirement we've been able to get away with getting our metrics for free (for the most part). In any case there's only like 5-10 minutes of lag, but since our customers generally look at yesterday's numbers 10AM local time it's not important.

So really, how big of a database do you need? With aurora unlimited storage you might as well use that. Do you need the data? At these prices you might as well keep all of it. Why not? Archive everything to s3, so you can rebuild it later (this has come in handy a few times).

From the UI, you need to eliminate queries until the user asks for them. Then limit the queries as much as possible. Use indexes. Ideally you'd pre-aggregate your data if possible.

For IoT, unless you need interactive responses just use HTTP GET requests into a CDN. No mqtt, etc. Why bother? And you probably don't have to worry about intermediate network devices clipping your GET requests, since you're deploying into someone's environment (make it a requirement for their network people).

For sizes and rows, they're not that big until recently. I think the biggest table has like 20-30 million rows? We aggregated stuff so our sizes were relatively small.

We have a monolith that handles the UI, api endpoints, and some maintenance things, and a bunch of lambdas that handles all the backend. Overall it's been pretty great; the backend that does work basically scales to some huge number. The real issue with lambdas is limiting concurrency so the DB doesn't get overwhelmed, and watching the memory/timeout numbers. Oh, and making sure that when you hook them up to SQS you don't let AWS fire up like 2000 lambdas (which works great for s3 processing, btw).

Re: Ask HN: How much traffic do you serve and with which database engine?

#29
post #2

I think you might be asking the wrong questions. They key questions are Queries per second and the median response size of the query. For example at reddit (15 years ago) we had 10x more vote traffic than comment traffic, but we only needed two databases to handle votes (technically only one the other was just for redundancy). But we needed nine comments databases. Mainly because the median query response was so much…

Unrelated: I love HN; a random database question and fkn jedberg is one of the first responders

jascinating!

Re: Ask HN: How much traffic do you serve and with which database engine?

#30
post #2

I think you might be asking the wrong questions. They key questions are Queries per second and the median response size of the query. For example at reddit (15 years ago) we had 10x more vote traffic than comment traffic, but we only needed two databases to handle votes (technically only one the other was just for redundancy). But we needed nine comments databases. Mainly because the median query response was so much…

[deleted]
Post reply on HN