When the COVID lockdowns happened, Chess.com saw traffic spike 4x over their current water level. And it would go country by country. It would just, it came in a wave. As folks started to stay home and wonder, what do I do with my time now that I can't go outside? Many millions of people turned to Chess. First of all, that's great. Second of all, they had to shard the databases and switch to application layer joins and get new hardware and all sorts of stuff was happening through 2020. And the other thing that happened is this incredible miniseries called The Queen's Gambit came out on Netflix and everybody was watching that. And the traffic went 4x again. My name is Josh Levine and I'm the CTO at Chess.com.
This is Code Story. A podcast bringing you interviews with tech visionaries.
Six months moonlighting. There's nothing on the back end.
what it takes to change an industry.
It took many goes to get right.
Who built the teams that have their back.
The company is its people. The teams help each other achieve. I was proud of our team.
Keeping scalability top of mind.
All that infrastructure was a pain. Yes, we've been fighting it as a group. Total waste of time.
The stories you don't read in the headlines.
It's not an easy thing to achieve, my dear. Took it off the shelf and dusted it off and tried to begin.
Deride the ups and downs of the startup life.
You need to really want it. It's not just about technology.
Listen more on Code Story. I'm your host, Noah Labhart, and today how Josh Levine is building and optimizing the ancient game of chess, played by many and loved by all. Josh Levine lives in Brooklyn, New York. He started programming when he was six years old when his dad brought home an Apple II. He realized that though there wasn't enough Legos in the world to support his creativity, he could get enough RAM. Growing up, he had a deep relationship with chess, setting up his own chess program. In fact, he states that he learned everything he knows about programming by programming chess. Outside of tech, he's married with two kids. He loves karaoke and is a musician with his music online under the name Heavy Pennies. In 2011, Josh joined an amazing online game website when they started supporting his favorite game variant. Ten years later, he researched this company and their technology to see how it worked. He applied for one of the jobs, got rejected, but then quickly got a call from the CEO, who actually liked his application. This is Josh's creation story at Chess.com.
Chess.com is a website and an app where you can play chess against other people or dive into all the different aspects of engaging with chess, like chess puzzles or taking lessons or reviewing your game or doing analysis of different positions. I'm not sure most everybody knows. I think people have been playing chess for 1,500 years. To bring that online and make it accessible to several hundred million people, I think is the mission of chess.com. For me, my first relationship with chess.com was in 2011 when I joined the website as a member. I was previously playing on the free internet chess server. I hadn't joined Chess.com yet, even though it had been around and you could play chess online on Chess.com previously, because I am a big fan of this chess variant called Bughouse. It's two teams, and as you play, when you capture a piece, you hand it to your partner. They can place that piece on their board as their turn, and it just gets wild. I didn't join Chess.com in the very beginning because their Bughouse support didn't exist. Eventually, in 2011, they finally launched Bughouse support, and then I was a paying member. My joining Chess.com story, it was February of 2021. I was coming out of lockdown. I was on an F train platform in Brooklyn waiting for the train to come, playing Blitz games on my phone. and I was going to meet a friend for the first time in the city for a year. We were all locked down. And so I'm playing this three-minute game of finishes. I can't remember if I won or lost. I've played, I think, almost 22,000 games on chess.com. But I was curious, how did they make this website? Is this just the free internet chess server turned over with a good branding? Or what is that? And normally when I'm researching how a company makes their tech, I just go to the jobs page and I see who they're hiring for. You can get a good overview of the technology there, if they're actively hiring. And so on the jobs page of chess.com, I saw, okay, PHP. I'm like, all right, that's cool. Java, PHP and Java. That's a little bit weird. All right. iOS, native iOS, Android, things like that. And then I get to the bottom and there's this job posting. It says VP of engineering. And I get filled with dread. I'm like, I'm not going to be good enough. This is going to be too big of a team size for me. I don't have the technical skill. Who knows? I just had imposter syndrome all at once, just dumping brain chemical all over me. And I click it and it's pretty great job description. Gotta love chess, gotta be good at engineering, have to have a sense of humor, this and that. And I was like, wow, that's really kind and settling to see a level headed job description, not a more corporate version, which I was definitely afraid of. And I clicked the apply button and it's literally a Google form. There were three text areas. It was basically the same as the job description. It's like, why do you love chess? Why would you be this job from an engineering perspective and what questions do you have for us? I filled it out. I told him about my chess engine. I told him about the teams that I'd been on and companies that I'd been helping to support, startups and other things and the tech that I've been involved with. I fired it off. I went to meet my friend. I had a great time and I came home and forgot about it because I was just like, yeah, whatever. The next day I got an auto rejection letter. It's just like, you are not the right fit. I'm like, I knew it. Oh no. I felt terrible. that I had found this thing because then it would just be more disappointment. But then the following day, the CEO, Eric, wrote me an email and was like, hey, we get hundreds of these applications every day and your submission stood out and I'd love to chat. And I was like, okay, cool. This is great. When do you want to chat? I sent that off and he sends back immediately. How about right now? And I'm literally like out in front of my house walking my dog. So I get on Zoom with Eric and And Eric Alabest is an incredible human being. His kindness just pours through any medium. And we got to talking. We got along really well. And then that was the beginning of the journey. I met more people at chess.com. I guess they liked me because I started in July of 2021 as the VP of Engineering.
So my next question may be a little interesting because you joined after you'd been using the platform for quite a while. I'm curious about what was your MVP when you joined, right? What was not the MVP of the company or the product, but like, what was the thing, the project that you had to go step in and take on? And how did you go about it?
When I first joined chess.com, really, I was focused on three main ideas, building relationships, building and gaining speed of transferring knowledge between everyone on the team, not and then of course our projects. And wow, we had so many different areas that had evolved to their current state. I dove in directly to the chess engine analysis in the cloud project. Now, mind you, I was contributing in many, how do you put it when there's the team, there's the process, there's the architecture itself, there's how we manage production and our vendors and budgeting, right? So this chess engine in the cloud project, it was struggling. We have a new feature in the last couple of years called Game Review, and this was powering an early version of that. And basically when a chess game finishes, you want to send the whole game up to the cloud for the chess engines to analyze it. And so they have to break apart every move and that has to fan out to run across multiple different engines in order to get a decent response time for people to look at the results. It was just hard. It was like a JavaScript monolith with a lot of interesting patterns. It delved deep into some low-level, bits-level transmission stuff for performance reasons, and then in the same breath was doing business logic. You know, we got into that project and tried to unwind basically how to do distributed systems, how to prevent single points of failure, how to monitor and observe service-level objectives. We didn't have very very many nines to start with, but we were working towards that. And then also adding features and functionalities at the same time. Really the goal of that particular technology is to explain why a certain move is good or a certain situation is risky or how to think about the qualities of a chess position in a way that's explainable to a human being, but that starts from a computer analyzing chess. And I think today, just coming from that, where we had our, I think we had eight engine nodes, as it were. Eight computers running as many cores as possible, running Stockfish on as many cores as possible, trying to produce these analyses results. And I think today we have 9,300 cores. And we've previously the thing would just use those eight engines no matter how many users are requesting. And now we can dynamically spill into the cloud. I don't know if this is the MVP, but it was definitely a huge project. Trying to store all the chess games is a big project. trying to create the real-time chess as a distributed system is a huge project. When I joined at that time, the Java part of the technology was this Java server that ran all the chess games. Every user's phone or browser would be connecting to this one server in Virginia. We had to deploy it and make changes to it, and so that would happen once a week. That's rough on cycle time, only being able to make changes to your primary offering once a week. There's only 52 changes a year. minus holiday and things like that. Massive distributed systems. I think also the process by which we develop our software. I could tell some stories about that.
So you've got the MVP, you're touching on the projects and they're massive, right? The things you have to take on and go, you know, figure out how to do. How did you progress that piece of the product and mature it? And I think it could be process, maybe a little bit about kind of roadmap ideas too. Maybe that's in the background, but process or roadmap. mature what you were working on, what you were building, what you were focusing on at chess.com.
So when I joined, I asked Eric, the CEO, I was trying to be nice. And I was just like, what do you think is going to go out to production in the next 90 days? And I thought maybe we should get to a two-year roadmap or something. And Eric looked at me and he's like, I don't know. I don't have a crystal ball. We don't know necessarily what we're doing next week. We had, and we still do in a lot of cases, run basically the parkour of agile development. A lot of things evolve in Slack, a lot of things evolve via conversation. And with that, we would ship like a lot, but we didn't have a visibility into what we were shipping. And Eric would literally navigate that via being present in channels and communicating extremely fluently on a trillion points. I looked at that and I'm like, oh, actually, this is really cool because I like to do that, too. But also I noticed some developers or basically all the developers had 60 to 70 Jira tickets in their personal assigned backlog. Like anything that was like a P2 or below, priority two or below would probably not get done unless someone would hop in a Slack channel and be like, hey, what about that thing? Can we work on that? Let me finish this and then I'll do that. So it was a lot of self-direction, which led to a lot of throughput. We were very productive, but wasn't super clear what was happening. And it definitely wasn't clear when things would happen. We created a concept of work streams. That word means something to different people in different contexts. But what it meant for us, we put a lasso around several groups of features and called it a work stream. So gameplay was a work stream. stream, our learning tools as a work stream. And we started to triage new work and then prioritize it versus what's already in the work stream. And we created an affinity between a tech lead and a product manager and a work stream so that every work stream, even if it didn't have a megaton of developers or designers working on it, the work stream would at least be triaged and the backlog will be groomed and we could start to understand the flow of what we were building and in what way. monthly cadence for Eric, CEO, to come in and say, what are we doing in gameplay? Here are the most important things we could be doing. Are they at the top of the list? And it created an ability for us to flow faster without every dev managing 70 tickets in their own personal backlog. We basically did it by building a Notion database. We still use Jira, but the one weird trick was we made a Notion database. The main properties are like the work stream, who's the PM, who's the the tech lead, et cetera. What is the point of this particular investment we're trying to make? And then we would keep a one-to-one ratio between the Notion card and a Jira Epic. And basically in the past, we would have a Jira Epic and it would have all the product specs in there and designers would attach things and there would be a whole megaton of comments going back and forth and like tickets would get made, but they'd mainly be make this part of the feature, make that part of the feature. The tech underneath the covers was never really clearly illuminated. It would happen via Slack or via conversations quests, or et cetera. And so by shifting the product specification over to Notion and having that highly collaborative editing experience there, and then having a one-to-one with the Epic, the Jira Epic could then be owned by the engineering team. And they would build the implementation path in terms of tech in the Jira Epic in order to reach the product specs that were in the Notion. And with this approach, we were able to get the super high level lenses lenses that Eric wanted to see for what are we doing in this work stream? What are the major things? And then we were able to get the super low level technical implementation paths laid out so that we could attach people to projects in a way that was more portable. Gosh, like it's a PHP monolith with vertically partitioned MySQL databases. I think there's like 21 clusters. You got to know what you're doing or you're going to bring the site down with the wrong query or the wrong cardinality or other things like that. So it was really important that we were able to out implementations like that. Where we came from was that each dev would get a project and just do it. And it was cool. Symfony, Model View Controller, and Doctrine, you can do that there. But as things started to get more complex with distributed systems or just the scale, I think today there's 20 billion games in the database. It's a lot. And then you think every game has at least two players, and you're trying to navigate that in a search criteria or something You have to think ahead.
I'm curious about team. There's a lot you're doing at chess. And you came in and there was a team. And I'm curious, combining maybe how it was done before and how you have changed it in your role and in your time. How do you go about building a team? And what do you look for in those people to indicate that they're the winning horses to join you?
I think that people need to be cared for first as human beings. those relationships, we will gain knowledge. And from that knowledge, we'll know what projects to do. I think basically that's what I brought to the table for the team. They were previously projects. There was a massive amount of love. There was a massive amount of joy for the mission of chess. And we know why we're here, right? We're not here to grind Jira tickets. We're here to make chess better for everyone in the world. But there wasn't a lot of focus on how we share knowledge, on who could be a mentor, on who could just help support when something is difficult, or you need to blow off steam, or vent some concerns, or some frustrations, or even some call-ups, or shout-outs for people. What I wanted to try to do was create a set of cadences in a space that people could rely on, and that they knew that they could bring themselves to that space with or without knowledge, with or without the projects, and that would be cared for. I would say relationships lead to knowledge leads to projects is the main approach that I took to building team. We also had some challenges in team building, largely because we have so many features and so many systems that I can't make a team around every feature. There's just not enough people to work that way. So we have to get that feeling of a common understanding and that time and space to get to know one another more intentionally than just, hey, create a pizza team and shove a bunch of sprints in front of them and then they'll gel.
So I want to flip to scalability, right? And you stepped into a system with some challenges in some areas. So I'm curious about how you approach scalability. scalability? And have there been interesting areas where you've had to fight it as you've grown? And I kind of know from some of the things you said, there probably are.
I want to wind back to actually before I joined chess.com through to 2019. And at the beginning of 2020, chess.com was growing about 10% a year. And we're very excited about that. And it was great business, at least from what has been shared with me and what I can see from metrics as well. Well, when the COVID lockdowns happened, Chess.com saw traffic spike 4x over their current water level. And it would go country by country. It came in a wave as folks started to stay home and wonder, what do I do with my time now that I can't go outside? Many millions of people turned to Chess. First of all, that's great. Second of all, they had to shard the databases and switch to application layer joins and get new hardware and all sorts of stuff was happening through 2020. And the other thing that happened at the end of the 2020, is this incredible mini-series called The Queen's Gambit came out on Netflix, and everybody was watching that, and the traffic went 4X again. It went again. Massive, thousand-yard stares from these SysOps folks who had been on call getting buzzed, and we had to move data center from LA to Virginia and get bigger boxes and bigger boats, basically, to carry all the water. again, like from every layer of the stack, from the edge through the application layer, internal load balancers, databases, everything needed to scale. For a while there, there was several folks who were just staring at that all day, every day, watching, monitoring, and trying to address issues proactively in the code base. When I joined, it was stable, but then we saw some major traffic, an additional. We just keep basically 4x-ing and then finding our water level at 2x below that, and then 4x-ing and again. So in 2022, we had a massive amount of traffic coming in because there was like a chess championship, and then there was this thing with cheating and other things that just drew a lot of attraction to the sport. I think it was at the opening of 2023 in January, our head SysOps guy came to the mission control channel. When things are going it. And he came there and he's like, this week we have 10% more traffic. And then the next week he's like, and now we have 10% more traffic again. Uh, guys, we're all just, we're watching this and it got to the point. And again, we had moved from a data center in LA to Virginia to have a bigger data center. We've done this. And in 2023, like we were getting so much traffic that the front door switches and firewalls were dropping packets in the data center. That's bad. That's hard to get it around. How are you going to navigate that? We had to figure ways to create hybrid workloads, right? We have to run workloads not only on-prem, but also in the cloud. We had to tune everything. If you have one N plus one query in a PHP web pool, if one of those processes is taking a little bit longer, it can actually soak and fill up the entire amount of processing capability that you you have. So any slow secondary or third service that you're calling from PHP can bring down the entire website when you have a single pool. So we did some things where we actually ordained our monolith as a service and using Cloudflare and other routing tools, we would route certain paths or path prefixes to certain pools of resources, sometimes to make sure that they would be up and be guaranteed to have PHP processes available or other times because They were going to get soaked and we didn't want them to soak everything else. So at least if they were dying over here in their isolated box, it wouldn't kill the rest of the experience for everyone else on the website. So we called that the modular monolith approach. We didn't have time to decompose all the different services, but we were able to isolate certain code paths behind certain routes and node pools inside of Kubernetes. We also brought a lot of services off or out of the monolith. You can think of things like storing games or real-time gameplay, think of things like puzzles. But every time someone makes a move in a puzzle, we store that and we calculate their puzzle rating and other transactional elements. And that's a lot of puzzles per second that happen there. So we need to think about the storage layer for that. We need to separate read layer and write layer for that. And any kind of integration between multiple systems has to handle, I don't know, 8,000 requests per second, something like this. It's no slouch. It's isolation of workloads to specific resource pools, CQRS separating of reads and writes, and then just like hammering down and untangling. The moment I remember being personally involved in that amount of scaling was with our live chess Java server. So this is that one server. It has a terabyte of RAM and like a hundred and something CPUs in it. And it's a massive box and it's running Java, multiple different thread pools. At that point, I think we saw 500,000 web socket connections to this thing and it was like occasionally reaching a deadlock or it would like get tuned out because the database would go too slow some query that used to take five milliseconds was now taking seven milliseconds and that would ultimately like backup back pressure into the user's experience this is old-school stuff right but if you have a Java running on a Linux you can run a kill minus three on that process and it'll dump the thread stacks to standard error and then you can look if you've got a lockup or something like that you can look and see what monitor is that doing a bunch of that and triaging and trying to write code fixes to change. In Java, there's this other thing called JMX, where anything that you've declared as a Java bean can have properties that get exposed over this JMX interface. Gosh, if that thing is exposed to the internet, someone could just come into your Java app, which is bad. But at one point when we were tuning connection pools to try to make the server stay alive under the weight of the massive chess interest, we tunneled into the live running server in order to tune the primary and secondary database connection pool parameters. It was pretty cool. We had like Datadog up on the right with graphs of how many connections were being created and relinquished and then how many queries were going through and the latencies on those queries and things like that. Literally, we were tuning how many threads are in the pool, how many active connections, etc. And it's invigorating. It's basically like doing a brain surgery while the thing is actually running. That was exciting. Nerve-wracking would be a better description of it.
When you step out on the balcony, you look across all that you've built, at chess specifically, what are you most proud of?
I think the team and the team members. I don't even talk about some of our personalization tools and things. It's called Engagetron. Pretty proud of that, proud of the team for that. but the team members and their growth and just the amount of hiring that we did I think when I joined we maybe had 90 people like all across engineering in every different area of it and I think now we're close to 250 it's more than doubled the team and we haven't really lost that sense of excellence or the key element of kindness and how we engage with one another it was basically flat when I joined, there was no real hierarchy. There was definitely a clear set of people who knew basically everything and they were indispensable. Now we have leaders in certain areas in infrastructure and in security and in architecture, in data and application development. We have a whole host of team leads who have taken on that responsibility and are learning that craft and are dedicated to getting better at that and to supporting their people. And I just think that's the most transformative thing you can do, right? You get people and you invest in them. And when they blossom and they get better, like everything around them gets better and they gain confidence in that too. And if you can do that in a way that's kind, and obviously you have to know what you're doing or chess.com will be down. I think it's the team and the people and how we've invested in them.
so let's flip the script a little bit tell me about a mistake you made and how you and your team responded to it so
we had done a bunch of performance tuning throughout 2022 and we're like this is going to be the year we change our reputation for quality and we're getting to the end of the year and we're like all right we shipped all this performance tuning i think we're ready for a massive scale. We got together with the marketing team and we decided to run a banner on the homepage of chess.com that said, see if you can crash our server. And basically just by coming and playing a live chess game. Oh gosh, that didn't go right. It crashed the server. And man, we were, we were a little, I think overconfident clearly. And I think the lesson to do. We should have done it with a feature flag or some percentage of users or something else like that. We were a bit brazen. But yeah, we crashed the server largely due to hubris, our own hubris. It was a pretty bad mistake.
So this will be fun to ask. And as a player myself and a big fan of chess.com, what does the future look like for the product and for the team?
I think more and more chess will be offline and online. I think more and more people are going to want to understand the game and want to be able to learn and develop their skills. And I think that everybody's journey with chess is unique and thus the experience on chess.com will need to be personal to them. I'm a big believer also in like multimedia and I think it would be cool if we could put a chess coach in everyone's pocket. actually so many cool things coming. Like I think chess is going to get more fun. I think chess is going to get more accessible for folks who don't know how to play yet. We're going to help them through that because chess is easy to lose, but losing is learning and learning is winning. There's a massive amount of personalization and meeting that person where they are in their journey to help them and encourage them. Now you're just getting my personal opinion, but I I think that chess is a way to engage with your own self-development and growth. It's super easy to realize you're not Magnus Carlsen. And it's also fun when you find a fork or when you find a cool mating solution or you even just solve a puzzle. To be honest, it's fun to just move the pieces on the board because it's cool.
It looks cool. I
think that the future includes more people willing to engage with their own growth and development and recognizing that any amount of time spent on chess helps with that. Whether they're a mathematician or an artist or a teacher or they're a finance person or they're in marketing or sales or any other life pursuit, it grows your capabilities from their foundations. I hope that the future just has more and more of the earth taking advantage of that.
Josh, let's switch to you. Who influences the way that you work? Name a person or many persons or something you look up to and why.
I would say CEO of Chess.com, Eric Alabest, is definitely a major influence on me. He's always able to bring the kindness in the conversation. No matter what information or knowledge is being exchanged, he cares about human beings. He cares about everyone and just really shoulders that and brings that to the table. And at the same time is relentless for excellence. A lot of folks will try to use a sort of a shame or a fear or some other penalty to motivate people. If you skip that and you motivate with joy and with love, people will do way better.
Josh, last question. 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 and can't wait to show it off to you right there in the plane. and maybe not starting chess.com, but helping to grow it to what it is today.
I would just say the same thing as before, is that the relationships that you have with the people around you who are on this journey with you are going to lead to more knowledge, which will lead to the right projects. And if you treat those relationships with kindness and with love, then you're going to build an incredible thing. And if you just go for the projects, then you're probably going to burn through a bunch of relationships. And then when it gets hard, you'll be on your own.
Advice. Well, Josh, thank you for being on the show today. And thank you for telling your creation story at chess.com.
Thank you so much for having me.
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. And when you get a chance, leave us a review. tremendously. And thanks again for listening.