Abstract
Secure container runtimes serve as the foundational layer for creating and running containers, which is the bedrock of emerging computing paradigms like microservices and serverless computing. Although existing secure container runtimes indeed enhance security via running containers over a guest kernel and a Virtual Machine Monitor (VMM or Hypervisor), they incur performance penalties in critical areas such as networking, container startup, and I/O system calls. In our practice of operating microservices and serverless computing, we build a high-performance secure container runtime named Quark. Unlike existing solutions that rely on traditional VM technologies by importing Linux for the guest kernel and QEMU for the VMM, we take a different approach to building Quark from the ground up, paving the way for extreme customization to unlock high performance. Our development centers on co-designing a custom guest kernel and a VMM for secure containers. To this end, we build a lightweight guest OS kernel named QKernel and a specialized VMM named QVisor. The QKernel-QVisor codesign allows us to deliver three key advancements: high-performance RDMA-based container networking, fast container startup mode, and efficient mechanisms for executing I/O syscalls. In our practice with real-world apps like Redis, Quark cuts down P95 latency by 79.3% and increases throughput by 2.43x compared to Kata. Moreover, Quark container startup achieves 96.5% lower latency than the cold-start mode while saving 81.3% memory cost to the keep-warm mode. Quark is open-source with an industry-standard codebase in Rust.
Introduction: The Security-Performance Trade-off
In the modern landscape of serverless computing and microservices, security is a non-negotiable requirement. Standard container runtimes like runC achieve high performance by sharing the host OS kernel, but this creates a significant security risk: a single kernel vulnerability could allow an attacker to escape the container and compromise the entire host.
To mitigate this, "secure" runtimes such as Google’s gVisor or Kata Containers isolate containers within a lightweight Virtual Machine (VM). However, this isolation typically comes with a steep performance "tax." Traditional secure runtimes often rely on a full Linux kernel inside the VM and a heavy VMM like QEMU. This architecture introduces three major bottlenecks:
- Networking Latency: Data must traverse both the guest and host network stacks.
- Slow Startup: "Cold starts" can take hundreds of milliseconds, while "keep-warm" strategies waste excessive memory.
- Expensive Syscalls: I/O operations trigger slow context switches between the guest and the VMM.
The Quark Architecture: QKernel and QVisor
Quark addresses these challenges by moving away from the practice of "shrinking" existing VM technology. Instead, it is built from the ground up in Rust, treating the Guest Kernel (QKernel) and the Virtual Machine Monitor (QVisor) as a single, co-designed unit.
By replacing the generic Linux guest kernel with the specialized QKernel, Quark eliminates unnecessary overhead and allows for deep optimization of the interface between the guest and the host. This ground-up design enables three core innovations that define Quark's performance profile.
TSoR: High-Performance RDMA Networking
One of Quark's most significant advancements is TSoR (TCP Socket over RDMA). Traditional networking in secure containers is slow because it requires multiple copies and stack traversals. Quark bypasses the traditional kernel network stack by utilizing Remote Direct Memory Access (RDMA).
Crucially, TSoR provides a standard POSIX socket API. This means that existing applications can leverage RDMA's high-speed, low-latency capabilities without any code changes, bringing near-native networking speeds to sandboxed environments.
Hibernation Mode and QCall
To solve the dilemma of slow startup times versus high memory usage, Quark introduces a Hibernation Mode. Using a custom Bitmap Page Allocator, the system can reclaim memory from idle containers via madvise without corrupting the guest kernel's internal state. This allows containers to remain in a "warm" state with a tiny memory footprint, ready to wake up instantly.
Furthermore, Quark replaces traditional blocking hypercalls with QCall (Asynchronous Syscalls). By using shared memory queues (QLib) between the QKernel and QVisor, guest vCPUs can submit I/O tasks and immediately continue other work, while dedicated threads in the QVisor handle the actual I/O processing. This shift from synchronous "traps" to asynchronous "job queues" mirrors the operation of modern high-performance hardware.
Performance Evaluation
Quark was evaluated against industry-standard baselines, including runC (non-secure) and Kata Containers (secure/VM-based), across various applications like Redis, Node.js, and Etcd. The results demonstrate that Quark effectively bridges the gap between security and speed:
- Redis Performance: Quark reduced P95 latency by 79.3% and increased throughput by 2.43x compared to Kata.
- Networking: Quark achieved a throughput of 34.3 Gbps. For small 64-byte messages, its latency was 9.3µs, which is approximately 71% lower than
runC. - Startup & Memory: The hibernation mode achieved 96.5% lower latency than a cold start while saving 81.3% of the memory required by traditional keep-warm approaches.
Conclusion and Future Work
Quark proves that secure container runtimes do not have to be slow. By co-designing the kernel and VMM in Rust, Quark delivers high-performance RDMA networking and ultra-fast startup times while maintaining OCI and CRI compatibility for Docker and Kubernetes.
Future work will focus on expanding syscall coverage beyond the current 150 common Linux calls and testing the system's resilience against "noisy neighbor" effects in massive, multi-tenant production environments. Quark is currently open-source, providing a high-performance foundation for the next generation of serverless computing.
Summary updated