How Microsoft brought SQL Server to Linux

Back in 2016, when Microsoft announced that SQL Server would soon run on Linux, the news came as a major surprise to users and pundits alike. Over the course of the last year, Microsoft’s support for Linux (and open source in general), has come into clearer focus and the company’s mission now seems to be all about bringing its tools to wherever its users are.

The company today launched the first release candidate of SQL Server 2017, which will be the first version to run on Windows, Linux and in Docker containers. The Docker container alone has already seen more than 1 million pulls, so there can be no doubt that there is a lot of interest in this new version. And while there are plenty of new features and speed improvements in this new version, the fact that SQL Server 2017 supports Linux remains one of the most interesting aspects of this release.

Ahead of today’s announcement, I talked to Rohan Kumar, the general manager of Microsoft’s Database Systems group, to get a bit more info about the history of this project and how his team managed to bring an extremely complex piece of software like SQL Server to Linux. Kumar, who has been at Microsoft for more than 18 years, noted that his team noticed many enterprises were starting to use SQL Server for their mission-critical workloads. But at the same time, they were also working in mixed environments that included both Windows Server and Linux. For many of these businesses, not being able to run their database of choice on Linux became a friction point.

“Talking to enterprises, it became clear that doing this was necessary,” Kumar said. “We were forcing customers to use Windows as their platform of choice.” In another incarnation of Microsoft, that probably would’ve been seen as something positive, but the company’s strategy today is quite different.

Kumar also noted that many enterprises were looking for an alternative to Oracle’s database products. If you want to run Linux and use a proprietary relational database with full enterprise support, you aren’t exactly spoiled for choice, after all.

As Kumar told me, this wasn’t the first time his team looked at Linux support. “We had a couple of discussions in the past where it wasn’t approved,” he told me. “It wasn’t something considered to be a strategic way for the business.” But three years ago — now with Satya Nadella at the top of the company — the team decided to pitch this idea again.”The biggest surprising part was that we were expecting a whole lot of back and forth. It was really surprising to see how quickly the decisions got made,” Kumar said.

Sitting over a bowl of pho at a Vietnamese restaurant in Redmond, the team made the final decision to go ahead with the project. But with that decision made, the team now faced a daunting task, though: how do you port the tens of millions of lines of SQL Server’s code to Linux? Kumar didn’t want to make any compromise in functionality either, so it either had to be the full core of SQL Server or nothing at all (and for now, that excludes the graphical user interfaces and tools the company offers on Windows).

The team found its answer in a project that already existed at Microsoft: Drawbridge. Drawbridge was a research project that launched back in 2011 which basically provided a container with a small API surface and a basic version of Windows configured to efficiently run the application in the container. The idea here was basically to build better and more secure virtual machines. The library OS then executes the application, handles memory management and other vital functions, and integrates with the underlying operating system.

About two years ago, the SQL Server team decided to make this the core of its Linux efforts. “The leadership expressed the right amount of concern,” Kumar commented — and my guess is that there was indeed quite a bit of concern given that Drawbridge was very much an experimental project. But the SQL Server team took over the Drawbridge code base and added it into the SQL OS layer.

This OS layer was, in many ways, what made this project possible. Because SQL Server’s needs always went beyond what Windows and Windows Server were able to offer, especially with regard to memory management, the team had already built many of the standard OS features into SQL Server’s OS layer already. Thanks to this, SQL Server in Drawbridge could manage its own memory, too, for example. The work on this was successful enough that the team didn’t just build this for SQL Server on Linux but actually merged SQL OS and the work it did on Drawbridge into the new SQL Platform Abstraction Layer that now runs on Windows and Linux.

As a result, the SQL Server team can work from a single code base and doesn’t really have to worry about where the code will run (and this includes Microsoft’s Azure platform).

SQL Server for Linux should reach general availability later this year. Even today, a couple of companies are already using it in production, and the Linux version now runs as fast as the Windows version (assuming comparable hardware).

Looking beyond the final release, Kumar noted that the team would take a close look at what to do next. While innovation in the database space continues to accelerate, not all of Microsoft’s customers want annual (or even faster) updates for their mission-critical systems. Given that we’ve lately seen annual SQL Server releases with SQL Server 2016 and 2017, though, I’d be surprised if we didn’t hear about the first SQL Server 2018 preview releases sooner rather than later.