RavenDB embedded at massive scales

28
RAVENDB EMBEDDED AT MASSIVE SCALES

Transcript of RavenDB embedded at massive scales

Page 1: RavenDB embedded at massive scales

RAVENDB EMBEDDED AT MASSIVE SCALES

Page 2: RavenDB embedded at massive scales

ABOUT MERodrigo Rosauro, Software Architect Manager at RDI

• Technology passionate• Developer• 14 years of experience in software development• Working with RavenDB since 2013

Page 3: RavenDB embedded at massive scales

ABOUT RDI

• We make restaurant automation software for QSR

• Our software runs on more than 36K restaurants

• Estimated number of individual machines: around half a million

• Processing almost USD $50K per second of customer payments

Page 4: RavenDB embedded at massive scales

“ONE IN A MILLION IS NEXT TUESDAY”

- Gordon Letwin, Architect for DOS 4

Page 5: RavenDB embedded at massive scales

HOW WE USED TO PERSIST DATA ON POS... and still do (on legacy modules)

Page 6: RavenDB embedded at massive scales

LEGACY PERSISTENCY

• Flat files• Custom data format• Event sourcing persistence• Rebuild in-memory state at

every restart

Page 7: RavenDB embedded at massive scales

PROBLEMS WITH THAT APPROACH

•No querying – at all•High complexity to store new data•No standard data format•Lack of management tools

Page 8: RavenDB embedded at massive scales

WHY WE DECIDED TO USE A DBMS?

Page 9: RavenDB embedded at massive scales

WHY A DBMS?

• We started a full re-architecture of the POS platform

• We are definitely not database/persistence specialists

• We wanted to remove complexity to persist data

Page 10: RavenDB embedded at massive scales

THE SEEK FOR A DBMS

Page 11: RavenDB embedded at massive scales

GOALS / GUIDELINES

• The new architecture is based on plug-ins, so we wanted each individual plug-in to have its own, isolated, database• Zero administration• Easy schema upgrades• Transparent replication• Unit tests

Page 12: RavenDB embedded at massive scales

WHY WE CHOSE RAVENDB?

Page 13: RavenDB embedded at massive scales

WHY RAVENDB?

• .NET• Embedded operation mode• In-memory mode for unit tests• Multi-tenant• Good transparent replication options

Page 14: RavenDB embedded at massive scales

WHAT RAVENDB ALLOWED US TO DO

Page 15: RavenDB embedded at massive scales

RAVENDB AT RDI

• Create unit tests without mocking the database• Have advanced statistics about the data persistence• Both system-wide and per plug-in

• Transparent replication• Hot failover, data distribution & real-time backups

• Transparent encryption of data at rest

Page 16: RavenDB embedded at massive scales

THE CHALLENGES... and how we faced them

Page 17: RavenDB embedded at massive scales

CHALLENGE #1 – MEMORY CONSTRAINTS

Page 18: RavenDB embedded at massive scales

SPECIALIZED, OLD HARDWAREOld hardware (sometimes 10 years old) means that we have very little memory and processing power.

Page 19: RavenDB embedded at massive scales

MEMORY CONSTRAINTS

• Many iterations with the RavenDB support team to fine-tune its memory usage

• We learned that under these constraints, caching can be evil

• In the end, the solution was to completely disable caching on RavenDB and do some cache at the application side, only for the “hot” data.

Page 20: RavenDB embedded at massive scales

CHALLENGE #2 – ESENT

Page 21: RavenDB embedded at massive scales

WE ARE STILL USING RAVENDB 2.5

• Our software must support Windows XPe

• .NET 4.0

• 32 bits machines

• … this means that ESENT is our only option for now

Page 22: RavenDB embedded at massive scales

FACT: WE DON’T LIKE ESENT(at least not for our usage scenarios)

Page 23: RavenDB embedded at massive scales

WHY?

• Any unclean shutdown may cause a completely undetermined result• Power outages / Application crashes / Task kill

• The possible results are not easy to find out during regular testing• Crappy hardware doesn’t help

• We still face sporadic full database losses with ESENT

• Copying data between OS versions is awful

• Recovering from most unclean shutdowns requires using ESENTUTL.EXE

Page 24: RavenDB embedded at massive scales

ESENTUTL.EXE

• We also hate don’t like ESENTUTL.EXE

• Many different commands to attempt to recover from different kinds of unclean shutdowns. Some have different syntax on different OS versions

• We had to automate all that (zero maintenance, remember?)• Almost 500 lines of code

Page 25: RavenDB embedded at massive scales

“SUCCESS IS STUMBLING FROM FAILURE TO FAILURE WITH NO LOSS OF

ENTHUSIASM”― Winston S. Churchill, Ex-prime minister of UK

Page 26: RavenDB embedded at massive scales

THE FUTURE

Page 27: RavenDB embedded at massive scales

THE FUTURE

• Working with Hibernating Rhinos to improve Voron to our use case• 32 bits support• Better reliability on unclean shutdowns

• We may jump straight to RavenDB 4.0 & CoreCLR• Long-term target: Around 250K individual POS nodes running

RavenDB embedded

Page 28: RavenDB embedded at massive scales

THANK YOU VERY MUCH