Evaluating Foundationdb As a Replacement for Mongodb
Total Page:16
File Type:pdf, Size:1020Kb
Edvard Viggaklev Bakken Edvard Viggaklev Bakken Viggaklev Edvard Evaluating FoundationDB as a replacement for MongoDB An emerging NOSQL system with ACID transactions at its core Master’s thesis in Computer Science Master’s thesis Master’s Supervisor: Svein Erik Bratsberg May 2019 Evaluating FoundationDB as a replacement for MongoDB for as a replacement FoundationDB Evaluating NTNU Engineering Department of Computer Science Department of Computer Faculty of Information Technology and Electrical Technology of Information Faculty Norwegian University of Science and Technology of Science University Norwegian Edvard Viggaklev Bakken Evaluating FoundationDB as a replacement for MongoDB An emerging NOSQL system with ACID transactions at its core Master’s thesis in Computer Science Supervisor: Svein Erik Bratsberg May 2019 Norwegian University of Science and Technology Faculty of Information Technology and Electrical Engineering Department of Computer Science Abstract Is it possible to replace several different database types with a single database? The newly open-sourced Founda- tionDB promises just that, without compromising on integrity or performance. It claims to provide a minimalist storage engine, with strong guarantees, that can be molded to fit any data model. It could possibly reduce the complexity and costs of any large project, by acting as a single replacement for several systems at once. In the fall of 2018, FoundationDB released a plugin, the Document Layer, that claims to act as a plug-and-play replacement for MongoDB in existing applications. This thesis examines the architecture and features of FoundationDB and the Document Layer, uncovering their strengths and weaknesses. Additionally, the system is compared to MongoDB, a well-established and popular NOSQL database. Preliminary benchmarks are performed, and the results are used to guide the creation of a cus- tom benchmarking tool, specialized for the two systems. The intention is to evaluate FoundationDB’s potential as a replacement for existing systems. The examination shows that FoundationDB provides a highly scalable and robust key-value store, stripped of supplemental features. It has fully ACID-compliant transactions, providing much stronger guarantees than most competitors, including MongoDB. FoundationDB exposes an extensive API, allowing users to tailor the system to their needs. However, the newly released plugin is deemed not mature enough to replace MongoDB. Performance results were somewhat disappointing, and a wide range of benchmarking workloads revealed flaws that must be resolved before the Document Layer can be considered as a true competitor. i Sammendrag Er det mulig a˚ erstatte flere databasetyper med en´ enkelt database? FoundationDB, som nylig ble sluppet som apen˚ kildekode, lover a˚ tilby akkurat dette, uten a˚ matte˚ ofre integritet eller ytelse. Den past˚ ar˚ a˚ kunne levere en minimalistisk databasemotor, med sterke garantier for palitelige˚ transaksjoner, som kan tilpasses enhver data- modell. Den kan potensielt redusere kompleksiteten og kostnadene i ethvert stort prosjekt, ved a˚ fungere som en samlet erstatning for flere systemer pa˚ en gang. Høsten 2018 lanserte FoundationDB en utvidelse til databasen, FoundationDB Document Layer, som skal kunne være en ”plug-and-play”-erstatning for MongoDB i eksisterende systemer. Denne masteroppgaven undersøker akitekturen og nøkkeltrekkene ved FoundationDB og Document Layer, for a˚ avdekke deres sterke og svake sider. Systemet sammenlignes med MongoDB, en veletablert og populær NOSQL- database. Det gjennomføres innledende tester, og resultatene benyttes i utviklingen av et spesialisert test-verktøy for de to systemene. Intensjonen er a˚ evaluere FoundationDB sitt potensiale som en erstatning for eksisterende systemer. Undersøkelsen viser at FoundationDB tilbyr en robust og skalerbar key-value-database, uten unødvendig ekstra funksjonalitet. Den har transaksjoner som oppfyller ACID-kravene, noe som gir sterkere garantier enn mange andre utfordrere, inkludert MongoDB. FoundationDB tilbyr et ekstensivt API som tillater brukere a˚ tilpasse systemet til deres behov. Den nylig lanserte utvidelsen virker dog ikke a˚ være moden nok til a˚ erstatte MongoDB. Ytelses- tester avslørte noe skuffende resultater, og det ble oppdaget flere feil og mangler som ma˚ utbedres før Document Layer kan anses som en reell utfordrer. ii Preface This Masters Thesis was written for the Department of Computer Science (IDI) at the Norwegian University of Science and Technology (NTNU), as the final deliverable for the Master of Science in Computer Science program. The research was conducted in the spring of 2019 by Edvard Viggaklev Bakken, under the supervision of Svein Erik Bratsberg. The thesis builds upon a preliminary, exploratory project, which was completed in December 2018. Acknowledgements First of all, I’d like to thank my supervisor Svein Erik Bratsberg for his kind and valuable assistance throughout this project. He kept me on the right track when the volatility of young, emerging technologies attempted to derail this project more than once. I’d also like to thank Abakus, the student union for Computer Science and Communication Technology; they’ve created a wonderful social environment for their students, and helped me persevere throughout this degree. I’d like to give extra thanks to the Web Committee, which taught me everything I know about programming. Finally, I’d like to thank my family, and the friends I’ve made along the way. iii iv Contents Abstract i Sammendrag ii Preface iii Acknowledgements iii Table of Contents v List of Tables viii List of Figures viii Glossary and abbreviations ix 1 Introduction 1 1.1 Motivation............................................... 1 1.2 Research goals ............................................ 2 1.3 Caveats ................................................ 2 1.4 Structure of thesis........................................... 2 2 Background 3 2.1 Background theory and definitions.................................. 3 2.1.1 Transactions ......................................... 3 2.1.2 The CAP theorem ...................................... 4 2.2 NOSQL systems ........................................... 4 2.2.1 Categories of NOSQL databases............................... 5 2.3 Document stores ........................................... 5 3 Foundation DB 7 3.1 History ................................................ 7 3.1.1 Early beginnings and mission ................................ 7 3.1.2 Acquisition by Apple..................................... 7 3.1.3 Re-release of the software as an open source project .................... 8 3.1.4 Technical developments ................................... 8 3.2 Architecture.............................................. 8 3.2.1 Client............................................. 10 3.2.2 Distributed key-value store.................................. 10 3.3 Features................................................ 12 3.3.1 The foundation........................................ 12 3.3.2 Operations, concurrency and performance.......................... 12 3.3.3 Fault tolerance ........................................ 12 3.4 Anti-features and drawbacks..................................... 13 3.4.1 Excluded features....................................... 13 3.4.2 Technical issues ....................................... 13 3.5 Current limitations .......................................... 13 3.6 Layers in FoundationDB ....................................... 13 3.6.1 The idea behind layers.................................... 14 3.6.2 Capabilities of layers..................................... 14 3.6.3 Design and implementation ................................. 14 3.6.3.1 Example of data model mapping ......................... 15 3.6.3.2 Example of a simple index implementation.................... 16 3.7 FoundationDB Document Layer ................................... 16 v 3.7.1 Overview........................................... 16 3.7.2 Key differences to MongoDB ................................ 17 3.7.3 Deployment and usage.................................... 17 4 MongoDB 19 4.1 What is MongoDB?.......................................... 19 4.2 Key features.............................................. 19 4.2.1 Structures and query operations ............................... 19 4.2.2 Scalability and availability.................................. 20 4.2.3 Storage engines........................................ 20 4.2.4 Transactions ......................................... 20 4.3 Comparing MongoDB and FoundationDB.............................. 21 5 Preliminary benchmarks 23 5.1 FoundationDB’s built-in test framework............................... 23 5.1.1 Drawbacks .......................................... 23 5.1.2 Benefits............................................ 24 5.1.3 Method............................................ 24 5.2 YCSB................................................. 24 5.2.1 Standard workloads...................................... 25 5.2.2 Configuration, installation and application versions..................... 25 5.2.3 Benchmarking FoundationDB................................ 26 5.2.4 Benchmarking MongoDB .................................. 26 5.2.5 Benchmarking MongoDB with stricter write concern.................... 26 5.2.6 Benchmarking FoundationDB Document Layer via MongoDB............... 27 6 Results of preliminary tests 29 6.1 Integrated test suite.......................................... 29 6.2 YCSB benchmarks .........................................