Live data from Hacker News

Cache is the new RAM

blog.memsql.com

51–60 of 97 posts

Re: Cache is the new RAM

#51
post #37

A couple points I would make with respect to the article: - In-memory databases offer few advantages over a disk-backed database with a properly designed I/O scheduler. In-memory databases are generally only faster if the disk-backed database uses mmap() for cache replacement or similarly terrible I/O scheduling. The big advantage of in-memory databases is that you avoid the enormously complicated implementation task…

Can you give some refs to make these statements more real? I'm trying to understand whether an in-memory db would be faster than postgres, for instance. What's the postgres I/O scheduler, and is it good? Are there benchmarks somewhere showing the difference? Why does the I/O scheduler make a difference for in-memory vs. disk databases? Is this a subsystem that caches the database in memory? Are you saying that, with…

PostgreSQL is a bit of a hybrid in terms of scheduling. It has its own disk cache but still goes through the kernel mechanisms. Classic database I/O schedulers are not portable so it is a bit of a challenge to implement one in big open source projects for reasons outside of technical ability.

With proper cache and I/O scheduler, the same workload will fit in memory, so the only way the disk gets in the way is if the I/O scheduling does something suboptimal with respect to writes (which happens a lot with the kernel caching behavior).

Modern database servers typically have more disk bandwidth than network bandwidth and therefore most write workloads should be able to go through storage at the network's wire speed, at least in theory. In practice, I/O scheduling behavior from memory to storage tends to be bursty or poorly timed. Consequently, the instantaneous I/O bandwidth requirements can exceed the effective disk bandwidth for brief periods and performance degrades.

A really good database I/O scheduler, cache, and execution engine work together to basically makes sure that peak bandwidth demands to the disk subsystem are never much worse than the network wire speed. Achieving this is not trivial and requires a lot of clever dynamic resource optimization but many sophisticated database engines implement this to some degree or another.

Re: Cache is the new RAM

#52
post #7

The database I want still doesn't exist. Here's what I want: - Easy sharding, a la Elasticsearch. I want virtual shards that can be moved node to node and an easy to understand primary/replica shard system for write/reads. I want my DB nodes to find each other with an easy discovery system with plugins for AWS/Azure/Digital Ocean etc. - Fucking SQL. I don't want to learn your stupid DSL. I want to give coworkers a SQ…

Have you looked at rethink DB? http://www.rethinkdb.com

I think it addresses most of your issues, except the SQL one, which I admit is a big one.

Re: Cache is the new RAM

#53
post #49
post #31

Earlier quoted context omitted.

It's impractical to write maintainable code in the forms of SQL I'm familiar with. But maybe someone here knows better. You should be able to abstract logic out to blocks for the duration of the query. Along these lines: cset means select id, venue_id from customer select venue_name from venue where id = cset.venue_id cset would be scoped to your connection. Instead of pages of copy-and-paste queries where the levels…

I mean, you can also use CTEs for that but it is of course limited. For all of the flaws of managing SQL, it's when I get handed giant swathes of dynamic SQL that I die a little inside.

I've just been reading up on CTEs - thanks. That's the kind of thing I thought would be out there.

Re: Cache is the new RAM

#54
post #7

The database I want still doesn't exist. Here's what I want: - Easy sharding, a la Elasticsearch. I want virtual shards that can be moved node to node and an easy to understand primary/replica shard system for write/reads. I want my DB nodes to find each other with an easy discovery system with plugins for AWS/Azure/Digital Ocean etc. - Fucking SQL. I don't want to learn your stupid DSL. I want to give coworkers a SQ…

I have a LOT fewer requests than you, but this one is just so irritating: >- Fucking SQL. I don't want to learn your stupid DSL. I want to give coworkers a SQL client a say "go! You already know how to use this!". If I want a new feature, then dammit, build on top of SQL the way PostgreSQL has. Odds are, regardless if its some JSON API or SQL, my language will have a client for it that will be superior than writing r…

This 100x this!

I'm sick and tired of this elitist new feature for new feature sake as well. Some of us have to work for a living and would like to go home after the workday instead of catching up on the new flavor of the week.

Re: Cache is the new RAM

#55

> It pisses me off to no end these developers have to out-think SQL and re-invent the whole damn new wheel for "efficiency's" sake. Worked with someone who did this a couple years ago. I keep trying to get him to explain why he was reinventing sql, and never did get a clear answer to that. > just waggles their dick around saying Sorry to be the one to say it, but I don't think that part was necessary or appropriate t…

> in conjunction with dick waggling is just funny, now that I think about it.

You understand that 'dick waggling' in this sense does not refer to the mechanical motions of a penis, right?

That it's what we call in English a "euphemism"? The gender-neutrality of the subject makes perfect sense when you understand that this euphemism, unlike human genitalia, is not gender specific.

In this case, "dick waggling" is a euphemism to mean "unwarranted bravado" or "unnecessary behavior performed only to prove that it can be accomplished".

Re: Cache is the new RAM

#56

A couple points I would make with respect to the article: - In-memory databases offer few advantages over a disk-backed database with a properly designed I/O scheduler. In-memory databases are generally only faster if the disk-backed database uses mmap() for cache replacement or similarly terrible I/O scheduling. The big advantage of in-memory databases is that you avoid the enormously complicated implementation task…

> In-memory databases offer few advantages over a disk-backed database with a properly designed I/O scheduler. Hmm...Michael Stonebraker would probably disagree with you on that. For his different newer projects, he claims and somewhat convincingly shows 10x or more performance improvements. The analysis is that ~10% of a typical disk-based system is useful work. By radically simplifying as a result of doing away wit…

No, Stonebraker is making many architectural assumptions that do not necessarily hold. Some observations about the design of good disk-based systems:

- Typical inexpensive server and disk systems today are quite a bit different than even five years ago. A database internals design heuristic that would be valid several years ago no longer applies in many cases. An "optimal" design can vary widely due to relatively small changes to the assumed constraints.

- The disk bandwidth typically exceeds network bandwidth by a significant degree. Even if you are saturating the network with inserts and similar, in theory you should be able to drive that through storage if you use the available IOPS efficiently and proactively.

- RAM is RAM. Whether backed by disk or not, the amount of data it can hold is approximately the same. Any significant differences in what you can put in RAM between in-memory and on-disk architectures has more to do with internal implementation and design choices, it is not intrinsic.

- In modern database kernels, no thread is waiting for I/O operations to complete. There is also few or no tree structures, locking, secondary indexing, context switching, and similar which are frequently the source of poor throughput. It tends to be much more linear, pipelined, and parallel.

All of the above aside, regardless of design, a database engine only needs enough throughput to saturate the network interface under load. Once the network is saturated, nothing you do in the database engine will improve the effective throughput of the database.

It turns out that it is pretty straightforward to design a disk-backed database kernel that can saturate 10GbE full-duplex for a wide range of workloads. Consequently, the supposed performance benefits of in-memory are largely moot. It simplifies implementation but does not address a real performance problem on modern hardware relative to a modern database kernel design.

Re: Cache is the new RAM

#57
post #55

> It pisses me off to no end these developers have to out-think SQL and re-invent the whole damn new wheel for "efficiency's" sake. Worked with someone who did this a couple years ago. I keep trying to get him to explain why he was reinventing sql, and never did get a clear answer to that. > just waggles their dick around saying Sorry to be the one to say it, but I don't think that part was necessary or appropriate t…

> in conjunction with dick waggling is just funny, now that I think about it. You understand that 'dick waggling' in this sense does not refer to the mechanical motions of a penis, right? That it's what we call in English a "euphemism"? The gender-neutrality of the subject makes perfect sense when you understand that this euphemism, unlike human genitalia, is not gender specific. In this case, "dick waggling" is a eu…

You understand that it isn't a "euphemism" as euphemisms are substitutions for vulgarity, not substitutions of vulgarity. Notice how the replacement you suggest, "unwarranted bravado," isn't blunt or vulgar? The term, as it was used, is a metaphor. As a metaphor, its imagery is fair game for criticism.

As for the criticism itself, I think it stands as the phrase is unnecessarily gendered.

Re: Cache is the new RAM

#58
post #25
post #7

The database I want still doesn't exist. Here's what I want: - Easy sharding, a la Elasticsearch. I want virtual shards that can be moved node to node and an easy to understand primary/replica shard system for write/reads. I want my DB nodes to find each other with an easy discovery system with plugins for AWS/Azure/Digital Ocean etc. - Fucking SQL. I don't want to learn your stupid DSL. I want to give coworkers a SQ…

>Fucking SQL. I don't want to learn your stupid DSL... If I want a new feature, then dammit, build on top of SQL What I hear is "I don't know anything better than the incredibly cut-rate solution I've been taught how to abuse, so I'm opposed to any improvements." SQL is a human interface language. I absolutely don't understand the desire that people have to use it for IPC. The tremendous set of SQL injection vulnerab…

If you make a system that's designed to replace SQL, doing everything SQL does and more, built by people with a lot of SQL experience, great!

But you get a lot of data stores making custom APIs without a comprehensive plan. That's what causes frustration. APIs that aren't generic. APIs that don't handle relations well or at all, sometimes with it bolted on too late.

Re: Cache is the new RAM

#59
post #7

The database I want still doesn't exist. Here's what I want: - Easy sharding, a la Elasticsearch. I want virtual shards that can be moved node to node and an easy to understand primary/replica shard system for write/reads. I want my DB nodes to find each other with an easy discovery system with plugins for AWS/Azure/Digital Ocean etc. - Fucking SQL. I don't want to learn your stupid DSL. I want to give coworkers a SQ…

> Fucking SQL. I don't want to learn your stupid DSL.

I really like one change in LINQ syntax (and probably various other SQL-inspired DSLs), which is to invert the basic query structure, enabling better IDE support:

from thing in things ... (yay, now my editor knows what a "thing" is and can provide better code completion and type checking for the remainder of this deeply-nested behemoth of a query that probably should be expressed as hundreds of simple statements instead of cramming half of the day's work into a single "statement" with no obvious rules for indentation because, after all, run-on sentences are notoriously annoying to read and generally should be avoided).

That alone is worth investing a few minutes to learn something new.

Re: Cache is the new RAM

#60

> It pisses me off to no end these developers have to out-think SQL and re-invent the whole damn new wheel for "efficiency's" sake. Worked with someone who did this a couple years ago. I keep trying to get him to explain why he was reinventing sql, and never did get a clear answer to that. > just waggles their dick around saying Sorry to be the one to say it, but I don't think that part was necessary or appropriate t…

There seems to be a culture clash on HN.

On one side there is California, where "dick wagging" is an unnecessary instance of gendered language, certain to drive women out of the tech industry.

On the other side there's the rest of the world, where being offended by "dick wagging" seems dazzlingly childish. It's just a penis, most grown men and women know what they are and observe their motions on a daily basis.

In Bhutan they draw penises on things for good luck. http://en.wikipedia.org/wiki/Phallus_paintings_in_Bhutan

Post reply on HN