small medium large xlarge

Modern Systems Programming with Scala Native: Write Lean, High-Performance Code without the JVM


Cover image for Modern Systems Programming with Scala Native

Modern Systems Programming with Scala Native

Write Lean, High-Performance Code without the JVM


Access the power of bare-metal systems programming with Scala Native, an ahead-of-time Scala compiler. Without the baggage of legacy frameworks and virtual machines, Scala Native lets you re-imagine how your programs interact with your operating system. Compile Scala code down to native machine instructions; seamlessly invoke operating system APIs for low-level networking and IO; control pointers, arrays, and other memory management techniques for extreme performance; and enjoy instant start-up times. Skip the JVM and improve your code performance by getting close to the metal.

Customer Reviews

If you’re interested in writing more performant, low-level code in a JVM environment,
look no further than Scala Native. This book will show you how to harness
its power to create lightning-fast software.

- Andy Keffalas

Lead Software Engineer

If you think the only way to do systems programming is with C, think again! Scala
Native is full of comparable features that enable us to implement the same applications
C is known for, but in a modern way. Reading this book is really an eye
opener that systems programming is not really a thing of the past, but is something
that is actually cool.

- Zulfikar Dharmawan

Software Engineer

Modern Systems Programming with Scala Native is a gentle but thorough introduction
to systems programming. Even if you are new to Scala Native, you can benefit
from reading this book.

- Gábor László Hajba

Senior Consultant

This book provides a great (re)introduction to the fundamental, close-to-the-metal
programming concepts in a way that those of us using higher-level languages
don’t deal with directly.

- Justin Nauman

Senior Systems Engineer

Modern Systems Programming with Scala Native is an excellent guide to applying
modern systems’ technologies and functional programming to service development.
Richard clearly demonstrates how Scala Native effectively models the concepts
and supports a high-quality implementation.

- Corey O’Connor

Founder, GLNGN, LLC

See All Reviews

Choose Your Format(s)

  • $24.95 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

What You Need

A modern Windows, Mac OS, or Linux system capable of running Docker. All code examples in the book are designed to run on a portable Docker-based build environment that runs anywhere. If you don’t have Docker yet, see the Appendix for instructions on how to get it.

Contents & Extracts

  • Preface
  • Foundations of Systems Programming
    • The Basics: Input and Output
      • Working with Output
      • Working with Input
      • Case Study: Google NGrams
      • What’s Next
    • Arrays, Structs, and the Heap
    • Writing a Simple HTTP Client
      • Defining Terms
      • Working with TCP
      • Making a TCP Connection
      • Testing Network Code with Netcat
      • Introducing HTTP
      • Implementing HTTP
      • Testing Our Code
      • What’s Next
    • Managing Processes: A Deconstructed Shell
    • Writing a Server the Old-Fashioned Way
      • Understanding How a Server Works
      • Building Our Server
      • Creating a Minimum Viable Server
      • Handling HTTP
      • Performance Testing with Gatling
      • What’s Next
  • Modern Systems Programming
    • Doing I/O Right, with Event Loops
      • Blocking and Polling
      • Introducing libuv
      • Working with Asynchronous TCP Sockets
      • Building an Asynchronous HTTP Server
      • What’s Next
    • Functions and Futures: Patterns for Distributed Services
      • Designing an Asynchronous API
      • Introducing Futures
      • Implementing Futures
      • Implementing an ExecutionContext
      • Futures and Promises
      • Introducing libcurl
      • Asynchronous curl
      • What’s Next
    • Streaming with Pipes and Files
      • Looking at Streams, Files, and Descriptors
      • Streaming Pipe Input in libuv
      • Streaming File Input in libuv
      • Streaming File Output in libuv
      • Stream Processors
      • What’s Next
    • Durability: An Embedded Key-Value Database with LMDB
      • Introducing Embedded Storage
      • Defining LMDB Concepts
      • Working with the LMDB API
      • Serialization and Deserialization with JSON
      • Putting LMDB on the Web
      • What’s Next
    • Services: Encapsulation and Abstraction for Modern Designs
      • Services and Distributed Systems
      • Parsing, Revisited
      • Moving from Server to Service
      • Implementing an Idiomatic Service DSL
      • Integrations and Ecosystems
      • The Way Forward


Richard is a data engineer at M1 Finance in Chicago, where he designs large data pipelines using Scala-based technologies like Akka and Spark. He’s made open-source contributions to Scala Native and Apache Kafka, and he blogs and speaks frequently about Scala and other functional programming topics.