LinkedIn is changing the iOS app development process forever with Rocket Data, a caching service that works with any database.
Rocket Data came about while LinkedIn was rewriting its own mobile app. It wanted a caching system that would present information to the end user (you) while pulling in more information from the network.
Core Data is Apple’s solution for managed data, which offers caching to a degree (and used by tons of iOS applications), but LinkedIn wasn’t fond of it when it tried Core Data in other applications.
Specifically, LinkedIn says Core Data blocks rendering and causes dropped frames. It’s also not thread-safe, and doesn’t scale well. When schema changes, the entire database needs to be migrated.
In non-nerdspeak: Core Data is great for small applications that have little going on, but LinkedIn is a juggernaut. Core Data won’t do.
Rocket Data and the competition
Realm, URL cache and serializing models to disk were also services LinkedIn looked at, but none had all of the following requirements:
- Immutable, thread-safe models.
- Consistency among models in both memory and in the cache, so that when a model is updated, all other instances of this model should also update.
- Non-blocking access on all reads and writes.
- A simple eviction strategy.
- Ability to scale well with a large number of model types, schema changes and listeners.
- Automatic migrations.
Rocket Data keeps Core Data’s mutable threads, but adds immutability. View controllers access data via an API, and the managed data models work in the background.
Developers can continue to use any data model they like, so long as it implements a Rocket Data protocol that lets it access the model identifier. Rocket Data also works with Swift classes, value types and Objective-C classes.
The API works with any key-value store, and data doesn’t need to be migrated on schema changes. If data can’t be parsed into a model, Rocket Data treats it as a ‘miss’ and reloads data from the network.
It may be a bit of custom tooling, but LinkedIn is sold on Rocket Data. You might be, too; it solves a caching hurdle many developers run into as apps scale, which is often the reason for crashes and slow performance.
Rocket Data is also being made available as an open source framework on GitHub, so developers can use it for free — or tweak it to suit their needs.
Get the TNW newsletter
Get the most important tech news in your inbox each week.