text
stringlengths
0
1.82k
**Ben Johnson:** Yeah, that's a good point.
**Brian Ketelsen:** That's what Nathan Youngman says on our Slack channel, "A package for a single idea" is something he heard from a talk a little bit ago. And that's good advice if you can well define what an idea is. If an idea is something not very broadly defined, that might work.
**Erik St. Martin:** So talk to us about the motivation behind this series of posts. Is this something you're going to continue doing? And this is kind of like a side step from some of the things that you've been talking about, right? The first two GopherCons; the first one was writing high-performance databases, the s...
**Ben Johnson:** \[12:02\] I think that I go from low level to high-level, and back again. I think that this structuring of projects and these high level concepts, they're kind of where I am now. I've been doing a lot more at the application level, and trying to figure out how that looks for Go applications. One thing ...
**Erik St. Martin:** There is a lot of the whole 'fear of missing out' thing. All these new technologies come out and you want to feel that you need to use it.
**Ben Johnson:** Yeah, totally.
**Erik St. Martin:** Otherwise you feel like you're obsolete, you're not sticking with modern times. But as you said, the majority of people's systems just don't need to scale. Everybody doesn't have Kubernetes-level problems. If you have just three nodes that you're managing, I'd argue that you probably don't need Kub...
**Ben Johnson:** I totally agree.
**Carlisia Thompson:** Going back to something that Ben said… Ben, what do you think or tell people when they say, "Well, Go is not really for web apps; I don't know if it's even for API." Do you hear people say that?
**Ben Johnson:** I think it does well with APIs. I think… I did a talk over at GopherCon for the kickoff party that was around... A lot of the industry is moving, we're not doing… Well, two things that Go's not really good at is templating and SQL databases. I mean, it's not great. You can use it, but it's not great. A...
**Carlisia Thompson:** Yeah, and even Amber - I learned that actually just yesterday, that they have something that generates JSON API's pack, and if you have a schema for that, I think they auto-generate code. Somebody was saying it's super easy, and we can do that with an API in Go, of course. Now, I have to follow u...
**Ben Johnson:** If you use something like… I came from Rails before Go; that was my most recent language I was doing before Go.
**Erik St. Martin:** You're in good company. We're all ex-Ruby on Rails people.
**Ben Johnson:** \[16:07\] When you're doing simple web apps that don't need a lot of performance, Rails is pretty great. You just throw some migrations up there, and you just start typing, and you get all kinds of stuff for free. You're never really interacting with SQL at that low level. Go has some ORM tools; I have...
You have to break it out, and then we recreate, rebuild it back again. Going through the whole idea of setting these strings over to a database, they have to get parsed, and they get optimized, they get saved in a query cache, and then they get planned, and all this stuff... There's so many crazy steps involved in usin...
**Erik St. Martin:** So I need to find the YouTube talk that I saw, and I may be misspeaking about what he worked on, but I believe that he worked on DB2, or something along those lines. And he was doing a talk, basically, about the things he knows for certain, which is history repeats itself, and he was bringing up th...
**Brian Ketelsen:** Yeah, in the '60s.
**Erik St. Martin:** Yeah, it was built into the mainframe application, everything. That's just what it did. And they had these maintenance windows when they would update, and then they needed to try to avoid that as the internet came to be and these systems needed to be online more, they couldn't withstand being down....
So SQL came to light because SQL was sellable to business people. You could teach the basics of SQL to a business person fairly quickly, before you get into complex joins and indexes, and all that stuff. But if somebody wanted to query spreadsheet-ish data, they could do that, and that was the shift there. He was talki...
**Ben Johnson:** Yeah, for sure. If you look at SQL databases.... SQL is just an abstraction layer, underneath the running whatever kind of engine underneath, which is essentially just a key/value store from a Row ID2, some byte-encoded row that's in there. That's interesting just to look at all the little layers.
**Erik St. Martin:** And the difficulty there with performance becomes because of that layer of abstraction, it has to seek so much data of off disk to bring it up into the layer that starts doing the filtering. I know my SQL especially over-fetches data. At least that's done on the machine level, it's not all being pa...
**Ben Johnson:** Yeah.
**Erik St. Martin:** \[20:00\] I like the approach that we're starting to think about things differently. I like the idea of column-oriented databases, things like... Cassandra was a big one I kind of liked. You could have these really wide rows, and you could scan along them, and read in just as much of that as you wa...
**Carlisia Thompson:** I have to say that if you have used a NoSQL database and have experience and you can make tradeoff calculations, it's great. But if you don't have that much experience, and you want to know, "Okay, I have this data model, should I be looking at a NoSQL style or architecture?" It's really hard to ...
**Erik St. Martin:** I think NoSQL is also an abstraction. So underneath, NoSQL is interacting with a
key/value store, too. So it's just trying to use some sort of probabilistic algorithm where it needs to go to find the data. I think that's an abstraction, too.
Choosing databases is hard, you really have to look at your data model and your access patterns. If you're looking stuff up by key a lot, having the overhead of a SQL Database just doesn't make sense. But there's also speed of development. Everything's a tradeoff. If you're doing a lot of stuff that's doing aggregates,...
**Ben Johnson:** Yeah, yeah. I think the difference of NoSQL versus SQL... I think the NoSQL isn't necessarily key/value, it's really more… There's been a lot of databases that try to optimize for a certain domain, I guess, and that tends to be where they shine. If you have a database around time series data, you could...
The things that I like specifically about key/value is that there's a lot of features that you think of that tend to be more around SQL databases, where it's like, "Oh, you have a schema!" A schema and a key/value store can be just a serialization library. ProtoBufs is actually a good serialization library, and they gi...
\[24:10\] Another thing, when you think about SQL and the SQL language - and I've done SQL for years, and I still find it to be really frustrating when you get down to more complex queries. Your query language when you're actually using a key/value store ends up being Go, which is awesome, because you can do anything y...
**Erik St. Martin:** There's little misses too, with people, with even indexing. The number of people that are surprised to find out that a single query only uses one index. You think it's the index-2 fields, and they're searching on both fields that somehow it does some sort of merge of those indexes and it makes thin...
**Ben Johnson:** Oh, yeah. Depending on how you order the fields of the index, they may or may not use it based on statistics, and the statistics can change over time, which can change your query plan. There's a lot of unknowns, and again, crazy stuff that happens inside of a SQL databases that I think we've become acc...
**Erik St. Martin:** The hard part about the shift becomes when you're not a 100% sure what you're going to do with your data. It becomes very easy to open up a CLI app, or your favorite GUI app for a SQL Database, and just poke around with the data, and start trying queries, and discover what it is that you're trying ...
So I can agree that a key/value store is fantastic for my use case, but it becomes hard, because how do I manage backups and restores, and things like that? There needs to be operational pieces of it too if you're going to stand it up in production. Along with the overhead of building your own code to interact with the...
**Ben Johnson:** Yeah, I totally agree with that. I think there's a lot of education side too that's missing. If you're going to start off in that world, it's just not much there to fall back on and to learn from. I hope that improves. I'm definitely going to be writing some blog posts on that, too.
**Carlisia Thompson:** That's a call-to-action for you too, Brian \[laughter\].
**Brian Ketelsen:** Exactly. So I have a question for you, Ben. This is a kind of out-there question. Usually when you have a project, you get a feel for how people are using it. What is the craziest thing you've seen done with BoltDB?
**Ben Johnson:** I would definitely say… This is easy, I can answer this right away. At the GopherCon, I was talking to Marty Schoch—I don't know if that's how you pronounce his last name. He does Bleve—which I thought was always called BLEEVE. But Bleve si the full-text search in Go.
**Brian Ketelsen:** Yup.
**Ben Johnson:** He actually wrote an LSM tree with Bolt; like, there were multiple Bolts that were merged together at runtime. As far as key/value stores go, they tend to be either LSM trees, which are kind of like these LevelDB or RocksDB. They end up having these different levels of data storage, and they get merged...
**Brian Ketelsen:** \[28:17\] So how does that work? Is each level a Bolt database?
**Ben Johnson:** Yeah.
**Brian Ketelsen:** Wow.
**Ben Johnson:** Just cool, yeah. He made it work. He actually got a performance improvement for… I think it was write performance he was doing. I don't remember the details, but he has a lightning talk. It was great.
**Erik St. Martin:** Well, LSM trees are very efficient on writes. That's why you see stuff like RocksDB. They're very highly optimized for the right speed.
**Ben Johnson:** Sure, sure.
**Brian Ketelsen:** I'm interested... Did he implement the Bloom filters, and stuff like that to determine…?
**Ben Johnson:** I don't know if he got that far. That would be pretty cool.
**Erik St. Martin:** Yeah, I want to see that. If you have a link to that, I would be very interested in that, because that type of stuff really interests me, and… We would have a whole week of episodes on how B trees work, and LSM trees, and all that stuff, but…
When we say LSM, for anybody who's not aware, log-structured merge-tree, and it's just kind of that access pattern, how it builds levels as it stores, and as Ben said, kind of merges them back together. Cassandra is also another big user of LSM trees.