Code Story · Transcripts

S6 Bonus: What If Git and MongoDB Had a Baby? Building a Version-Controlled Knowledge Graph with Gavin Mendel-Gleason, TerminusDB

August 11, 2022 · 22:24
Listen to the episode Download .txtDownload .vtt
Gavin Mendel-Gleason

The sort of roadmap in our minds was way too big to actually realize in practice with the kind of resources that we had. We got seed funding, we got a little over a million in seed funding. Then it was a little bit more practicable, like a lot of the kinds of ideas we could start to put into practice. But there was so much, right? So we were trying to be a bit driven by customer needs as well. So we had one early customer that drove like us trying to get very big graphs and less on the sort of incremental. Like, how do you how do you actually create those graphs in the first place? I'm Gavin Mendel-Gleason. I'm the CTO of TerminusDB.

Noah Labhart

This is Code Story, the podcast bringing you interviews with tech visionaries who share in the critical moments of what it takes to change an industry and build and lead a team that has your back. I'm your host, Noah Labhart, and today how Gavin Mendel-Gleason built a world-class tool with Git-like collaboration centered around data workflows. All this and more on Code Story. When asked what he does for fun, Gavin Mendel-Gleason likes to program for fun. He builds stuff in his spare time as tech dominates his life. But outside of tech, he has two daughters and his family enjoys spending time outdoors, specifically in the Alps. At Trinity College in Dublin, Gavin and his teammates were working on a project that required the storage and relation between loads of complex datasets. During this project, they decided to create a better kind of database to help solve these sorts of problems. This is the creation story of TerminusDB.

Gavin Mendel-Gleason

TerminusDB actually got started at Trinity College Dublin some number of years back. I think it's like six years ago now. and we were working on a project about long-scale historical research trying to look at patterns in history and look at the pattern of civilizations civilizational collapse disasters and the responses to those and what it takes to keep a society around so terminus was actually just a its genesis comes in us trying to figure out how to store all of the really complicated data that It would have to be time-scoped data. It would have to be geographically scoped. It had loads of different variables. All the variables had people who would vouch for them. So you'd take it from some source. You'd have some variables saying the human height in Britain during the late 1800s, according to military inductions, was this high. And that we found in this source. And he used this other source. So you have this really complicated sort of chain of provenance that you need to keep around, and you have very complicated information. And that problem really sort of drove us to try to create a different kind of database that would make it easier to do these sort of large-scale data management projects.

Noah Labhart

Well, tell me about the MVP for TerminusDB. Tell me about that first product you built. How long did it take you to build, and what sort of tools did you use to bring it to life?

Gavin Mendel-Gleason

It went through a lot of iterations actually. So the first thing we did was we were trying to figure out how to store this complicated data and we were looking at linked data solutions, like ways of trying to use RDF and OWL to try to structure this because it was such a complicated, interwoven sort of graph database-y type problem. My first prototype I guess was just in Prolog. So I just wrote a Prolog graph and I looked around to see if I could do it that way. And SWI-Prolog, I guess, there's this SWI-Prolog, has some really good tools for linked data. Pretty quickly, it became apparent that it wouldn't scale up very well. So once you got past like 20 million triples, then it started to fall over. So then we started trying to find out ways to get around that. that and I guess then I integrated HDT which is a headers dictionary triple library that's written in C++ with Prolog and then I kind of started playing around with that and that scaled really well in fact like that could scale up to really huge graphs like really just enormous graphs bigger than you could get in most other graph databases you'd have a hard time like loading that into Neo4j database for instance because you would just end up swapping to disk all the time. They were using these really unusual data structures, these succinct data structures, so then that got me really interested in succinct data structures. It didn't have a lot of the features that TerminusDB has in that it didn't have version control but it started me thinking about these sorts of things like actually you know how how do we do updates? And then I was thinking, okay, well, we could do updates where we actually create a new one of these, or we create intermediate layers that are also structured using these HDT-like data structures. And then, you know, from there, it was like very obvious, actually, that looks a bit like the way that Git does its storage where you store snapshots of things, but we wouldn't store snapshots because with data would be too large, but we'd store the diff between them. That sort of was the genesis of the first MVP.

Noah Labhart

From that point, from the genesis point, like you mentioned, how did you progress the product from there and how did you mature it? I think to wrap that in a box a little bit, I'm curious how you built your roadmap and how you decided, okay, this is the next most important thing to build or address or enhance with TerminusDB.

Gavin Mendel-Gleason

It's really been a process. It hasn't been one direction. vision. So myself and Kevin Feeney, we talked about this stuff constantly and how we would like the product to look. But that sort of roadmap in our minds was way too big to actually realize and practice with the kind of resources that we had. We got seed funding. We got a little over a million in seed funding. Then it was a little bit more practicable, like a lot of the kinds of of ideas we could start to put into practice but there was so much right so we were trying to be a bit driven by customer needs as well so we had one early customer they were essentially doing a corporate intelligence application and they had they had big graphs with complicated data that was time scoped and they needed to have that kind of information so that you could traverse edges in a time-scoped way. So for instance, like you'd have a company, the company has shareholders, but the company doesn't just have shareholders, right? The company has shareholders that hold shares at a particular time window, right? So you buy shares and then at some point you might sell them. So if you want to look at control of the company, the control of the company is a very dynamic thing that changes over time. So you want to be able to have this sort of graph where where everything's scoped by the time that it's in. And you can ask questions about time slices through that. That drove us trying to get very big graphs and going in that direction, and less on the sort of incremental, like how do you actually create those graphs in the first place? So then subsequently, we had another customer who was trying to do supply chain stuff, and their stuff was coming in very incrementally. So there wasn't like a big load process that you could do. just do the analytics, you had to keep something that was a little bit more like a transactional database. Then we started developing features on that basis to really make it more Git-like at that point. There was a lot of discussion, I guess, in the company. All of the employees actually were involved pretty heavily in the decision-making processes around these things about like what are we trying to build how are we going to bring this to life like databases are big things they're not like us i've i've um you know worked on quite complicated software in the past for chem informatics and stuff like that but in a lot of ways those it's often the case that your sort of mvp uh has lower barrier to entry than a database like a database base, people want it to be absolutely solid. They want it to be super fast. And the things that they have in mind have really like Postgres is an amazing, you know, piece of kit. So if you're trying to compare yourself to Postgres as the sort of baseline, you really have, you have a long way to run, you know, it's, it's, it's not an easy road.

Noah Labhart

So then my next question is probably even more important than normal. How did you go about building your team? And what did you look for in that they were the winning horses to join you and go tackle this hard problem.

Gavin Mendel-Gleason

It is very hard to get a good team together. We have an incredible group of people, but we didn't always make the right decisions on that. And that's, it is tricky to do. And I've learned over time, I was involved, very heavily involved in the hiring process, and I've learned I'm not very good at hiring. So, and you know, the bad side of this is like they say, good at hiring or good at firing. And that's really a disaster, right? When you have to fire people, it's not great. It's bad for morale. It's bad for everybody. And oftentimes, it's generally the fault of the person who hires them. There's a number of things you have to go after, and they're hard to get right, right? So you need somebody who can do the skill set that you're looking for. And that's already hard to find, especially if you're looking for database or people who are very adept at dealing with complicated modeling, hard to come by. In addition to that, you also need somebody who loves the thing, right? So because we're an open source product, that's a little bit easier. And I think that has helped a lot. If you're an open source product, one, you can get people working with it potentially before they're employed. And two, there's a feeling of contribution that you just can't quite get unless you're open source. the contributions that people put into it are in some way remembered. It's in GitHub. You know, you have put your piece out there in the world. So it's a little bit like artistry in a way. And, you know, being able to sign your art, I don't know. But I think, you know, people who are really interested in writing difficult code and beautiful code can be quite invested in that. And I know I am. I mean, it really drives me. I want to create something beautiful. that's what you have to also look for is the people who are not just there for the job, but trying to create something beautiful.

Noah Labhart

Given, you know, you got to get a database right out of the gate, right? I'm curious where you'll take this question, but let's talk about scale. So did you build this to scale efficiently from day one or have you been fighting this as you've grown and gained traction?

Gavin Mendel-Gleason

oddly like we were very scalable on day one and then we got unscalable by adding features and now we're really regaining that scalability that we had on day one so the the simplest um example you know without all of the features we could scale it i don't know i had we were ingesting data on it up to about a billion triples on and we're running 48 and then we had this giant memory image and everything's really great there but you couldn't update it and every time you wanted to change something you had to do a full upload so in some ways like it was very scalable in other ways it it it wasn't a like a transactional database so making it more like a transactional database and then having the sort of git like features slowed us down a bit and we're still in the process of recovering that so but two of the things like the first iteration we were using HDT which is like this C++ library and one of our engineers matthias he's a dutch engineer he wrote a rust proof of concept for this library and we were immediately very interested because we had had some seg faults in the hdt library and like parts of it were supposed to be re-entrant but actually weren't it was very very difficult to track them down. Like we put locks in places and you'd be dancing around trying to find out what's going wrong. And we have had much better experience with Rust being able to multi-thread, being able to really scale up, getting high speed, similar speeds to what we had in C++, but also much greater safety. So that helped us in that sort of transition. transition. At the moment, we're still in the process of really trying to get it up to Ferrari speed, which is where we want it to be. But that process has been pushing things down into Rust. So we have an orchestration layer that's done in Prolog. And a lot of the things that slow us down, we find out where the greatest time is spent and then push it down into Rust and then try to optimize that. So that's been the forever process. And I think it'll be the process is really going to be looking to really get this up to analytics scale where people can seriously use it for gigantic graphs but then also get like get like features on top of that you

Noah Labhart

know that's a powerful statement as someone who cut his teeth on c and c plus plus that rust is as powerful or get you were getting up to the the place that is as powerful as c plus plus that's a a that's a big deal

Gavin Mendel-Gleason

yeah no it's huge and i i was really impressed like i mean the ideas that go into rust are very interesting and so i was always interested from a sort of computer science theoretical view but i didn't think about actually adopting it until matthias had written that prototype implementation and you know i had just been fighting with this hdt library chasing down out bugs day and night for weeks. At some point, like when I saw this, I was like, okay, yeah, let's do this. Let's do this. Try it out. See if we can make it work. And, you know, I've never looked back. That was a great decision.

Noah Labhart

Okay. So then as you step out on the balcony and you look across all that you've built, what are you most proud of?

Gavin Mendel-Gleason

At the present moment, I guess that we can use the database. We have a project that we're working with called CAMS, which is the critical assets management system that we've been doing with ARISE US, which is the UN disaster response projects affiliate. It's trying to help Caribbean nations and other small developing nations deal with the impacts of climate change. They have some very graph-like problems where they're trying to look at the way that their assets relate to each other, which ones depend on which other ones. So there's a dependency chain problem. We participated in this project And we helped a lot to try to get them a working project in Dominica, which is a Caribbean country. And we're going to have another pilot project, I believe, in Costa Rica. And I'm quite proud that we were able to get the database to a point where we could really feel comfortable deploying it for real use cases like this that can help people.

Noah Labhart

Let's flip the script a little bit. and how you and your team responded to it?

Gavin Mendel-Gleason

We got an early customer. We had an early customer and we offered them a deployment and we just weren't ready. The database wasn't at a point where we could scale up to their needs. So we were trying to backfill like crazy. And then sort of halfway through that process, I think there was a sense, you know, we should just give up. And we kind of like only halfway, we had like one foot in continuing the project foot in like continuing development on the roadmap i think that was a mistake i think we should have gone two feet in and just made that customer uh the absolute happiest customer it would have we would have had to lay it a little bit in terms of like we it would have been a little bit of a diplomatic mission as well to to keep them uh okay with it keep them sweet but uh it would have helped because it would have sped up our attention to the problems that we face in industrial deployment. And we've really worked out a lot of those issues at this point. Many of them are still there, though. Some of them are still there, but we would have done it quicker if we just tried to go in with two feet. So I'm really of the opinion that you have to use these things in anger on real scenarios to really get a feeling for where the pain points are.

Noah Labhart

So, okay, let's switch to you, Gavin. Who influences the way that you work? You know, CEO, CTO, architect, person, any person you look up to and why?

Gavin Mendel-Gleason

My head engineer, I guess. I look up to him a lot. Like, he's an amazing programmer. Really insightful. Like, really big vision kind of guy, which is rare. So I like that. CEO that helped found the company. I really admired his vision as well. I guess in terms of like what my influences are, like if this was, if we were talking about records, like which bands I listen to, I think, you know, I'm really influenced by type theory. I like type theory a lot. And then I would say my single biggest sort of from computer science, my single biggest biggest influences, Saul Kripke. His ideas of Kripke structures, I think, influences how I think about databases and logic and query languages. So if anybody hasn't read Saul Kripke, like he was like 17, I think, when he published his first paper. And it was like a seminal paper in computer science. So it's well worth a read.

Noah Labhart

Okay, so we we talked about a mistake earlier, but a little bit different spin. If you could go back to the beginning, what would you do different? Or where would you consider taking a different approach?

Gavin Mendel-Gleason

At some points, I would have grown slower, been a bit more careful about growth. I would have probably tried to take on capital more slowly as well, take on capital more slowly and focus on consultancies that are building the product more. And I think that that's a good way you honest about the features that you're building, that the features you're building, because there's this problem, like if you have capital, you can try to guess, and then you try to get feedback from the consumer. But it's often best just to be your own consumer. It's easier to feel where the pain points are going to be that way, than if you're just like sort of guessing with your finger in the wind.

Noah Labhart

I like how you said that a lot with the being your own consumer, like eating your own dog food, building it, you know, yes, for this vision, yes, for the customer, but you're also building it for yourself. And that's a, that's a big, I don't know. I really like how you said that. Well, last question, Gavin. So, so you're getting on a plane and you're sitting next to a young entrepreneur who's built the next big thing. They're jazzed about it. They can't wait to show it off to the world. Can we show it off to you right there on the plane? What advice do you give that person having gone down this road a bit?

Gavin Mendel-Gleason

I don't know. give them a lot of advice probably about the whole process of taking on capital and how to go about it i think that's the hard it's a hard road and it changes all the time and at every stage it's different so you know every time you get bigger it changes again so i haven't done it yet so it's this crazy situation where you're always a novice at the same time i don't know how to give a general advice about that because it really depends a lot on the individual product and how the technology works, what the business plan is. Definitely, if you're going to do it, you're going to have to love the journey because maybe I would tell them that. If you don't love the journey, there's no point because there's going to be a lot of ups and downs. So you have to be there for the dream. I

Noah Labhart

think all of those are great bits well Gavin thank you for being on the show today thank you for telling the creation story of TerminusDB thank

Gavin Mendel-Gleason

you very much for having me

Noah Labhart

and this concludes another chapter of Code Story Code Story is hosted and produced by Noah Labhart be sure to subscribe on Apple Podcasts Spotify or the podcasting app of your choice support the show on slash Code Story for just $5 to $10 a month. And when you get a chance, leave us a review. Both things help us out tremendously. And thanks again for listening.

Transcribed with Whisper and reviewed for names and terms; speaker labels are automatic and may contain small errors. Timestamps link to that moment of the transcript.