Live data from Hacker News

Ask HN: Do you find working on large distributed systems exhausting?

news.ycombinator.com

251–260 of 261 posts

Re: Ask HN: Do you find working on large distributed systems exhausting?

#251

Earlier quoted context omitted.

This reads to me as if you have never really used mmap in a dedicated C/C++ application. Just to give you a data point, looking up one word_id in the LUT and reading 20 document_ids from it takes on average 0.0000015 ms. So if that alternative database takes on average 0.1ms per index read, then it's starting out roughly 65000x slower. "than a DB lookup (in the right style, with a reverse-index)" Unless, of course, y…

> Unless, of course, you're managing petabytes of data ;) Are...are you saying that you've purchased petabyte(s) of RAM, and that that multi-million dollar investment is somehow cheaper than...well really anything else? > But before that your 10gbit/s node-to-node link will saturate. Oops. Only if you're returning dense results, which it sounds like you aren't (and there are ways to address this anyhow), which is why…

No, of course I have a tiered architecture. HDDs + SSDs + RAM. By mmap-ing the file, the Linux kernel will make sure that whatever data I access is in RAM and it'll do best-effort pre-reading and caching, which works very well.

BTW, this is precisely how "real databases" also handle their storage IO internally. So all of the performance cost I have to pay here, they have to pay, too.

But the key difference is that with a regular database and indices, the database needs to be able to handle read and write loads, which leads to all sorts of undesirable trade-offs for their indices. I can use a mathematically perfect index if I split dataset generation off of dataset hosting.

It's really quite difficult to explain, so I'll just redirect you to the algorithms. A regular database will typically use a B-tree index, which is O(log(N)). I'm using a direct hash bucket look-up, which is O(1).

For a mental model, you can think of "mmap" as "all the results are already in RAM, you just need to read the correct variable". There is no network connection, no SQL parsing, no query planning, no index scan, no data retrieval. All those steps would just consume unnecessary RAM bandwidth and CPU usage. So where a proper DB needs 1000+ CPU cycles, I might get away with just 1.

Re: Ask HN: Do you find working on large distributed systems exhausting?

#252
post #245

Earlier quoted context omitted.

This reads to me as if you have never really used mmap in a dedicated C/C++ application. Just to give you a data point, looking up one word_id in the LUT and reading 20 document_ids from it takes on average 0.0000015 ms. So if that alternative database takes on average 0.1ms per index read, then it's starting out roughly 65000x slower. "than a DB lookup (in the right style, with a reverse-index)" Unless, of course, y…

Are you managing petabytes of data though? What kind of servers are you running? What's your max QPS? The fact is with your mmap impl. you probably use ram + virtual memory, and have more ram than needed to compensate for the fact that you don't keep the most used keys in memory, which a DB will do for you. Point is if you have petabytes of data and access patterns only mean you access a subset of it, even Mongo migh…

Just FYI, MongoDB storage also uses mmap internally.

So we are comparing here "just mmap" with "mmap + all that connection handling, query parsing, JSON formatting, buffering, indexing, whatever stuff that MongoDb does".

And no, MongoDB is effectively never a cheap solution. They are used because they are super convenient to work with, with all things being JSON documents. But all that conversion to and from JSON comes at a price. It'll eat up 1000s of CPU cycles just to read a single document. With raw mmap, you could read 1000s of documents instead.

Re: Ask HN: Do you find working on large distributed systems exhausting?

#253
post #33
post #19

Earlier quoted context omitted.

As you imply towards the end, I think things like numbers of hours worked are generally not relevant for stuff like this. I've been incredibly engaged working 12+ hour days and I've been burnt out barely getting 2-3 hours of real work in a day. It has more to do with the nature of the work.

Even though you only did 2-3 hours of "real work", how much actual time investment was in your job? I don't see how somebody can burn out working just 2-3 hours in a day. Maybe emotionally burnt out if you're a therapist or something, but not as a software engineer.

I guess it was more like that I got burnt out from other things and ended up only being able to get myself to work 2-3 hours.

That said, I wasn't working especially long hours before, either. Maybe not 2-3 hours but still sub-8. The burnout definitely wasn't caused by long hours.

'Burnout' is a pretty ambiguous word IME but in its most commonly used sense it's pretty unrelated to hours worked. My favorite definition is that burnout is a "felt loss of impact and/or control".

Re: Ask HN: Do you find working on large distributed systems exhausting?

#254
post #245

Earlier quoted context omitted.

Are you managing petabytes of data though? What kind of servers are you running? What's your max QPS? The fact is with your mmap impl. you probably use ram + virtual memory, and have more ram than needed to compensate for the fact that you don't keep the most used keys in memory, which a DB will do for you. Point is if you have petabytes of data and access patterns only mean you access a subset of it, even Mongo migh…

Just FYI, MongoDB storage also uses mmap internally. So we are comparing here "just mmap" with "mmap + all that connection handling, query parsing, JSON formatting, buffering, indexing, whatever stuff that MongoDb does". And no, MongoDB is effectively never a cheap solution. They are used because they are super convenient to work with, with all things being JSON documents. But all that conversion to and from JSON com…

MongoDB uses the Wired Tiger storage engine internally. The MMAP storage engine was removed from MongoDB in V4.2 which was released in March 2020. The MMAP engine was deprecated two years previously.

In MongoDB conversion to and from raw JSON into BSON (Binary JSON) is done on the client (aka driver) so the server cycles are not consumed.

Re: Ask HN: Do you find working on large distributed systems exhausting?

#255

Earlier quoted context omitted.

> Unless, of course, you're managing petabytes of data ;) Are...are you saying that you've purchased petabyte(s) of RAM, and that that multi-million dollar investment is somehow cheaper than...well really anything else? > But before that your 10gbit/s node-to-node link will saturate. Oops. Only if you're returning dense results, which it sounds like you aren't (and there are ways to address this anyhow), which is why…

No, of course I have a tiered architecture. HDDs + SSDs + RAM. By mmap-ing the file, the Linux kernel will make sure that whatever data I access is in RAM and it'll do best-effort pre-reading and caching, which works very well. BTW, this is precisely how "real databases" also handle their storage IO internally. So all of the performance cost I have to pay here, they have to pay, too. But the key difference is that wi…

And have your unreliable, iconsistent, unscalable system. That apparently goes down all the time.

Not using ES here is actually nuts.

Re: Ask HN: Do you find working on large distributed systems exhausting?

#257

Earlier quoted context omitted.

Typically people use RAID or ZFS to prevent data loss when a few hdds fail.

This cracked me up. Thanks fxtentacle :D.

of course, the reason that's wrong is that if one drive fails you don't have a 56pb storage system, you have something smaller because of redundancy.

That redundancy, and the performance that scales due to it, place cloud services in an entirely different class from on prem servers.

Re: Ask HN: Do you find working on large distributed systems exhausting?

#258
post #245

Earlier quoted context omitted.

Are you managing petabytes of data though? What kind of servers are you running? What's your max QPS? The fact is with your mmap impl. you probably use ram + virtual memory, and have more ram than needed to compensate for the fact that you don't keep the most used keys in memory, which a DB will do for you. Point is if you have petabytes of data and access patterns only mean you access a subset of it, even Mongo migh…

Just FYI, MongoDB storage also uses mmap internally. So we are comparing here "just mmap" with "mmap + all that connection handling, query parsing, JSON formatting, buffering, indexing, whatever stuff that MongoDb does". And no, MongoDB is effectively never a cheap solution. They are used because they are super convenient to work with, with all things being JSON documents. But all that conversion to and from JSON com…

As another already said, Mongo doesn't use mmap anymore.

Mongo doesn't convert to and from JSON. The driver uses a binary protocol.

Re: Ask HN: Do you find working on large distributed systems exhausting?

#259

Earlier quoted context omitted.

> Unless, of course, you're managing petabytes of data ;) Are...are you saying that you've purchased petabyte(s) of RAM, and that that multi-million dollar investment is somehow cheaper than...well really anything else? > But before that your 10gbit/s node-to-node link will saturate. Oops. Only if you're returning dense results, which it sounds like you aren't (and there are ways to address this anyhow), which is why…

No, of course I have a tiered architecture. HDDs + SSDs + RAM. By mmap-ing the file, the Linux kernel will make sure that whatever data I access is in RAM and it'll do best-effort pre-reading and caching, which works very well. BTW, this is precisely how "real databases" also handle their storage IO internally. So all of the performance cost I have to pay here, they have to pay, too. But the key difference is that wi…

No modern DB uses mmap because it's unreliable and hard to tune for performance.

A custom cache manager will always perform better than mmap provided by the kernel.

The problem is you haven't explained how the overhead of a DB is too much. Sure, it sounds like a lot of work for your servers and the DB compared to reading from a hashmap.

Where I work right now we fire around 1.5B queries a day... to Mongo.

Re: Ask HN: Do you find working on large distributed systems exhausting?

#260
post #245

Earlier quoted context omitted.

Are you managing petabytes of data though? What kind of servers are you running? What's your max QPS? The fact is with your mmap impl. you probably use ram + virtual memory, and have more ram than needed to compensate for the fact that you don't keep the most used keys in memory, which a DB will do for you. Point is if you have petabytes of data and access patterns only mean you access a subset of it, even Mongo migh…

Just FYI, MongoDB storage also uses mmap internally. So we are comparing here "just mmap" with "mmap + all that connection handling, query parsing, JSON formatting, buffering, indexing, whatever stuff that MongoDb does". And no, MongoDB is effectively never a cheap solution. They are used because they are super convenient to work with, with all things being JSON documents. But all that conversion to and from JSON com…

And 2 you're looking past the point. Any DB work work fine for this use case. If you wanted sharding, there's vitess for mysql, for example.
Post reply on HN