Tarantool on Apple M1 processors: first results


Spiderman + Youtube speedpaint by RowenHebing

Apple’s M1 processors are no longer news. Many people know about their performance and that applications for MacOS need to be adapted to the new architecture. In the Tarantool platform development team, we also recently set ourselves the same task.

I, Alexey Koryakin, technical director Tarantoolincluded in the VK ecosystem. I’ll tell you why we needed it at all (after all, macOS is not installed on production servers), how we solved the problem, and show the benchmark results.

How the problem appeared and how it was solved

Tarantool Is a high-performance in-memory computing platform that consists of a database and an application server. Often, developers install Tarantool on their work machines and write code there. For many, this is more convenient than working on a separate server, especially if they have one working computer.

Some developers on our team also install Tarantool locally for themselves. So does our product manager, who bought a new MacBook Air with an M1 processor earlier this year. And then one day he came to the technical team with the question: “Why doesn’t Tarantool work natively on the M1 processor? I recently bought a new MacBook Air and Tarantool only runs through Rosetta. Native support for Apple M1 processors could be a great advantage of Tarantool for our community, so that colleagues who have moved to promising Macs can effectively develop systems for Tarantool“.

The technical team thought and decided:

  1. Tarantool is known for being very fast. M1 is known for the same. We wondered how much faster Tarantool could become if we put it on M1?
  2. Apple is actively updating its entire line of Macs, moving them to the M1 (and now to the M1 Max), and developers and other IT professionals around the world are actively migrating to the new platform. Existing x86_64 software runs through the Rosetta emulation layer, which does not allow full use of the full power of software (including Tarantool) on new Apple processors. We need to fix this.

This is how we got a new priority task – supporting the M1 processor🙃

Around the same time, we were working on ARM64 support for Linux. Since M1 is also, in fact, ARM64 with its own specifics, we decided that we could simply implement support for M1. This turned out to be close to the truth: we closed most of the tasks to support M1 with ARM64 support for Linux. The main problems were associated with the specifics of the RISC instructions of the ARM architecture (for example, direct transfer of control from one piece of machine code to another is possible only within 2 MB offsets). The distinctive feature of M1 support is the Apple ABI, which differs from the ARM Linux ABI. I had to tune the Tarantool code specifically for new processors, peeping into the open Apple documentation

In general, supporting ARM64 and M1 in particular is a relatively straightforward engineering task. There were small features, but they were solved simply, without reading a ton of specifications and working at night. Everything took us about 4 months, from May to August.

Performance Benchmark

The M1 is renowned for its speed. Even code that runs through Rosetta is fast. We also did not bypass the issue of performance, we decided to check how much faster our Tarantool has become.

We compared macOS on affordable commodity devices with different fillings. We didn’t have the task of comparing different operating systems or racing against server processors like the Xeon. We wanted to know how much faster Tarantool will become for a developer who switches to a new MacBook, as well as a preliminary assessment of the prospects for the new Mac platform. For the test, several computers were used, which can now be found from developers or bought at re: Store:

  • MacBook Pro 16.2 (2020),
  • Mac mini 8.1 (2018),
  • MacBook Air 10.1 (2020), Apple M1.

We wrote simple benchmarkwhich has three components:

  1. This is Lua code, which means that the application server is involved.
  2. This code writes to the database, which means that the transactional database engine is involved.
  3. This code works on M1 and doesn’t crash 🙂

The benchmark runs in one system thread that runs 50 fibers, each of which inserts 100 operations in one transaction. This scenario puts more load on the CPU than on memory or disk. And since we are testing the processor, this is exactly what we need. If a transaction consisted of one or 3-4 updates, then the load would shift to RAM or disk rather than to the CPU.

We ran several tests, inserting 1 to 20 million records. Moreover, we carried out each test 15 times and then calculated the median value. Here complete results, there you can see in detail all the launches. And here, for clarity, we will show the median values ​​in the form of graphs.


Wall Clock Benchmark, median 15 starts. The smaller the value, the faster the code ran

We see that Tarantool on a laptop with an M1 processor shows 2 times better results than on a laptop of the same year with a different processor.

We also tested the M1 using the Rosetta translator. In terms of performance, it turned out to be about the same as the 2018 Mac mini, but noticeably faster than the 2020 MacBook Pro.


Wall Clock Benchmark. Same devices plus launch via Rosetta

We understand that this does not mean speeding up all applications in half. Everyone has a specific code, different tasks and conditions. But in any case, you can expect your local Tarantool installation to run faster.

What’s the bottom line?

Beginning with version 2.10.0-beta, Tarantool can be run natively on M1 processors. So far, this is preliminary support: something may break or work unstable. Now we have closed almost all bugs known to us, only a few non-critical ones remain. For example, there are some problems with the JIT compiler. But that didn’t stop the team’s product manager from installing Tarantool on his new MacBook Air and working with it every day.

Further, we will close the bugs known to us, as well as those that the developers will send. If you have a new Mac on an M1 processor, we suggest you try the new version of Tarantool. If something doesn’t work for you – write a bug report, we will help.

You can try the Tarantool cluster at try.tarantool.io, and get help – in Telegram chat

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *