Making Textbooks Accessible and Affordable
It’s an age-old problem for college students: too many heavy textbooks, at exorbitant prices. When Camilla Hessellund Lastein experienced these issues first-hand as a college student in Denmark, she was surprised to find that even in the digital age, there was no real resource for less expensive, portable e-textbooks. So she decided to come up with her own solution.
After a few years trying to get a prototype built with the help of various IT consultants, Lastein teamed up with Kasper Enggaard Krog in 2015 for a serious effort. The co-founders recruited a technology team to build Lix the way they knew it could work: an app that allowed students to easily purchase digital textbooks and then take notes, highlight and search them online.
Simon Stender Boisen, who was hired as the company’s CTO, ended up starting from scratch. “The first year was totally crazy,” he says with a laugh, “but it also meant that we were able to choose things that would benefit us the most going into the future because our goal has always been to stretch far beyond Denmark.”
The challenges for the team were two-fold: growing the audience of college students, as well as establishing relationships with publishers. The latter, Boisen says, just took time: “As a small startup working with humongous companies, it took time for publishers to even decide to work with us at all, let alone trust us to sell their books or work through issues like piracy.” With those initial struggles in the past, the business has grown steadily, with the Lix digital library now including more than half a million e-textbooks, and users across western Europe and in some parts of the U.S.
An Architecture Built for Speed
Given the functionality that the team wanted for the Lix app, certain architectural decisions were key. For instance, “The platform needs to be updated continuously so if someone writes a comment through a note you might have written to your book, they need to be notified immediately,” says Boisen.
In order to make scaling and live updates of user interfaces easy and quick, the team implemented an architectural pattern called Command Query Responsibility Segregation (CQRS), coupled with event sourcing. “Instead of storing the actual state of the system, which is what is most common, we store the events that reflect the actions that a user has taken in the past,” he says. “And instead of using the same data model for both write (command) and read (query), which is also most common, these are separated in CQRS.”
Because all the data model updates happen based on events, which by nature are live—that is, created at the very moment the command is received and processed—the data model is also live. Lix is written in Erlang, a so-called “functional” programming language that allows the company to have hundreds of thousands of concurrent, real-time models running on a single machine.
Under this system, Boisen estimates it takes 100 milliseconds from the time one user saves a comment until the time another user can see that information across the platform.
Moving to Kubernetes—and Equinix Metal
The first eight months in production, “we were running everything quite traditionally—basically a collection of simple virtual machines for various things,” says Boisen. In the fall of 2016, the team decided to start using Kubernetes container orchestration, and that led to other conversations about their infrastructure choices. “Since Kubernetes already provides some things similar to a virtualized environment, we thought it was kind of stupid that you had to run on top of already virtualized infrastructure,” he says. “We started looking for where we could get physical hardware but with cloud-style provisioning, and we quickly found Equinix Metal. Their on-demand provisioning was unique and the pricing was great, which also factors in when you’re a small startup.” This allowed Lix to use more powerful machines as their workload grew, achieving a lower cost for greater performance.
By the beginning of December, Lix had Kubernetes running in production on Equinix Metal servers, and the impact was immediate. “We got better performance; things were going much more smoothly,” says Boisen. At the same time, the development team was growing (it’s now around 15 full-time in Denmark, plus 5 others in Russia), and the new setup “gave us the ability to involve many developers at once, because the deployment process was so simple.” Further integrating their workflow, Lix deploys where everyone on the team congregates: directly through Slack. “We just tell the system to deploy something and then push it into production, allowing us to move faster and more easily integrate new employees.”
Furthermore, Boisen doesn’t have to worry that a fast-growing user base will create pain points at the infrastructure level. “With the old model we definitely would have had to manually add machines, or spend time squeezing performance out of VMs,” he says. “That’s not necessary with Equinix Metal—and as such it has been easier to forget about the infrastructure and simply focus on growing the business by improving our product.”
With a worry-free infrastructure in place, the Lix team can focus on growing the business: getting more of the right books on the platform, and constantly improving user satisfaction with the app. One feeds the other; user requests for particular books (or certain publishers) are a valuable bargaining chip. “We use customer feedback to show publishers that there is growing demand,” says Boisen, “and that including their books will result in increased sales.” Lix also leverages polling to show how many students get books in some illegal (e.g. pirated) method, creating a valuable incentive for publishers to invest in a legitimate digital platform from which they can sell their content.
For Lix’s CTO, though, his mission-critical work is to simply keep things running. “It’s obviously important to be able to implement all the things that the users and our publishers and partners want,” says Boisen. “My personal goal is to have a smooth operation where we can easily handle all these changes.”