Search code examples
mysqllinuxnvme

How to use MySQL database with NVMe SPDK?


I look at the documentation and don't see any practical implementation case in the examples.

Does anybody know how to ensure that incoming requests to my database server are processed via Intel NVMe SPDK?


Solution

  • You would need to develop a custom storage engine.

    The existing storage engines in MySQL use POSIX calls for I/O. In other words, they call standard kernel functions. This way they can support a wide range of storage devices and operating systems with portable code.

    As I understand SPDK, it is a library of user-space code entry points that bypass the operating system kernel's I/O interface, and read and write NVMe directly.

    So I assume it would require a complete rewrite of the I/O code in a MySQL storage engine to utilize SPDK. That would also make the storage engine non-portable. It would only work on hosts with NVMe storage devices.

    Then you would need to work on optimizing it for about 25 years, to match the level of maturity of for example the InnoDB code. Just doing the same I/O calls with the same usage pattern may not be the best way to utilize an NVMe drive.

    Even if you do all that, you probably would not find that it gives you a great improvement on performance overall for a complex service like MySQL. If your database is I/O bound, you're already losing. The better way to improve performance is to do no I/O, but read and write data in RAM. Even compared to NVMe storage, RAM latency is still at least three orders of magnitude lower.