Safe, Fast Sharing of memcached as a Protected Library

Memcached is a widely used key-value store. It is structured as a multithreaded user-level server, accessed over socket connections by a potentially distributed collection of clients. Because socket communication is so much more expensive than a single operation on a K-V store, much of the client library is devoted to batching of requests. Batching is not always feasible, however, and the cost of communication seems particularly unfortunate when—as is often the case—clients are co-located on a single machine with the server, and have access to the same physical memory. Fortunately, recent work on protected libraries has shown that it is possible, on current Intel processors, to amplify access rights quickly when calling into a specially configured user-level library. Library instances in separate processes can then share data safely, even in the face of independent process failures. We have used protected libraries to implement a new version of memcached in which client threads execute the code of the server themselves, without the need to send messages. Compared to the original, our new version is both significantly simpler, containing 24% less code, and dramatically faster, with a 11–56 × reduction in latency and a roughly 2 × increase in throughput.

[1]  Michael L. Scott,et al.  Hodor: Intra-Process Isolation for High-Throughput Data Plane Libraries , 2019, USENIX Annual Technical Conference.

[2]  Donald E. Porter,et al.  Rethinking the library OS from the top down , 2011, ASPLOS XVI.

[3]  Han Dong,et al.  EbbRT: A Framework for Building Per-Application Library Operating Systems , 2016, OSDI.

[4]  Michael L. Scott,et al.  Understanding and optimizing persistent memory allocation , 2020, PPoPP.

[5]  Amin Vahdat,et al.  Snap: a microkernel approach to host networking , 2019, SOSP.

[6]  Dawson R. Engler,et al.  Exokernel: an operating system architecture for application-level resource management , 1995, SOSP.

[7]  Timothy Roscoe,et al.  Arrakis , 2014, OSDI.

[8]  Hans-Juergen Boehm,et al.  Atlas: leveraging locks for non-volatile memory consistency , 2014, OOPSLA.

[9]  Martín Abadi,et al.  XFI: software guards for system address spaces , 2006, OSDI '06.

[10]  Zeyu Mi,et al.  SkyBridge: Fast and Secure Inter-Process Communication for Microkernels , 2019, EuroSys.

[11]  Peter Druschel,et al.  ERIM: Secure, Efficient In-process Isolation with Protection Keys (MPK) , 2019, USENIX Security Symposium.

[12]  Michael L. Scott,et al.  iDO: Compiler-Directed Failure Atomicity for Nonvolatile Memory , 2018, 2018 51st Annual IEEE/ACM International Symposium on Microarchitecture (MICRO).

[13]  Xiao Liu,et al.  Basic Performance Measurements of the Intel Optane DC Persistent Memory Module , 2019, ArXiv.

[14]  Edouard Bugnion,et al.  ZygOS: Achieving Low Tail Latency for Microsecond-scale Networked Tasks , 2017, SOSP.

[15]  Mark Handley,et al.  Network stack specialization for performance , 2013, HotNets.

[16]  Gernot Heiser,et al.  A Performance Evaluation of Rump Kernels as a Multi-server OS Building Block on seL4 , 2017, APSys.

[17]  Terence Kelly,et al.  Dalí: A Periodically Persistent Hash Map , 2017, DISC.

[18]  James R. Larus,et al.  The Singularity system , 2010, Commun. ACM.

[19]  Haibo Chen,et al.  Performance and protection in the ZoFS user-space NVM file system , 2019, SOSP.

[20]  Eddie Kohler,et al.  Speedy transactions in multicore in-memory databases , 2013, SOSP.

[21]  Chris Hawblitzel,et al.  Safe to the last instruction: automated verification of a type-safe operating system , 2011, CACM.

[22]  Michael Norrish,et al.  seL4: formal verification of an OS kernel , 2009, SOSP '09.

[23]  Christoforos E. Kozyrakis,et al.  Usenix Association 10th Usenix Symposium on Operating Systems Design and Implementation (osdi '12) 335 Dune: Safe User-level Access to Privileged Cpu Features , 2022 .

[24]  Michael M. Swift,et al.  Mnemosyne: lightweight persistent memory , 2011, ASPLOS XVI.

[25]  Robert Wahbe,et al.  Efficient software-based fault isolation , 1994, SOSP '93.

[26]  Christoforos E. Kozyrakis,et al.  IX: A Protected Dataplane Operating System for High Throughput and Low Latency , 2014, OSDI.

[27]  Eunyoung Jeong,et al.  mTCP: a Highly Scalable User-level TCP Stack for Multicore Systems , 2014, NSDI.

[28]  Terence Kelly,et al.  Failure-Atomic Persistent Memory Updates via JUSTDO Logging , 2016, ASPLOS.

[29]  HowellJon,et al.  Rethinking the library OS from the top down , 2011 .

[30]  Jim Gray,et al.  The Transaction Concept: Virtues and Limitations (Invited Paper) , 1981, VLDB.

[31]  Rajesh K. Gupta,et al.  NV-Heaps: making persistent objects fast and safe with next-generation, non-volatile memories , 2011, ASPLOS XVI.

[32]  Chris DiBona,et al.  Open Sources: Voices from the Open Source Revolution , 1999 .

[33]  Lei Zhang,et al.  Efficient Support of Position Independence on Non-Volatile Memory* , 2017, 2017 50th Annual IEEE/ACM International Symposium on Microarchitecture (MICRO).

[34]  Adam Silberstein,et al.  Benchmarking cloud serving systems with YCSB , 2010, SoCC '10.