If you’re a mobile developer you’ve probably, at one point, had to work with databases to store your app data on a device. Surprisingly, your choice in databases is limited, with SQLite being the most commonly used. It’s surprising because despite the many new databases that have been created over the past decade, none have been focussed on mobile. Bring on Realm: “a mobile database that runs directly inside phones, tablets or wearables.”
Realm is an open-source library that mobile developers can integrate into their app to store and query data. Data is queried from Realm’s internal storage engine (not yet open-sourced), which runs on your device and is built to get the best performance, both off- and online. The internal storage engine has been developed from the ground up to be memory-efficient, and provide the best performance to developers.
The company was founded by Alexander Stigsen and Bjarne Christiansen, who previously worked at Nokia’s R&D center in Copenhagen trying to figure out how to fit data in ever-smaller amounts of computer memory. Using their experience, and the idea that modern phones and tablets could equally benefit from data-fitting, they got accepted into the Summer ‘11 batch of Y Combinator and have been working on the problem ever since.
The company’s goal, according to VP of Product Tim Anglade, is to provide developers with a new start, allowing them to develop apps faster, launch and run their apps with less costs and make their apps more powerful.
Data in Realm is stored in, you guessed it, different realms (i.e. databases), with both disk and in-memory storage available. Disk storage is the default, allowing data to be persisted between app launches, saving developers extra calls to their APIs. This is also where Realm sees a lot of potential: saving on external storage costs.
As the app industry grows, so does the API industry, as developers turn to external APIs to store and query their data. This comes at a cost: renting servers, managing databases and data traffic. For common use cases, this means developers can manipulate data on a device, without having to pay for, or manage, any external services.
Realm’s iOS implementation (both Objective-C and Swift) shows the library to be well-constructed, using common data structures like objects and arrays. According to the documentation Realm provides important features, such as thread-safety, a simple API around data and easy linking of data (one-to-many, many-to-many) and also boasts a better performance over other implementations (like Core Data).
All in all, Realm is an exciting new player in the field of mobile databases: an area that could use some more options for mobile developers.
Realm is now available for iOS , but a version for Android will be released soon.