Powering an Operational Data Mesh at Nanit

Nanit

Summary

Nanit leveraged Materialize to build an operational data mesh to streamline the implementation of a microservices architecture. With Materialize, Nanit harnessed materialized views to track feature subscriptions and keep down the compute cost of its AI features. Nanit also avoided having to reimplement logic across each individual microservice. Additionally, Nanit democratized data by allowing teams to work with SQL.

About Nanit

Nanit is the high-growth parenting tech company that has changed the way parents view their babies’ wellness through the world’s most advanced baby monitor and parenting products. From the AI-powered Nanit camera that tracks and analyzes a baby’s sleep, to resources within Nanit Community and Nanit Lab, families can access personalized insights, guidance, and parenting data on demand.

Since launching in 2016, Nanit has tracked over 4 billion hours of sleep, 556 million parental visits, over 428 million morning wakeups, and delivered 20 million memories. For more information, visit www.nanit.com and follow Nanit on Instagram and TikTok

Before Materialize

For Nanit, the cost of running compute for its AI video features is very expensive. Nanit only wants to run these services if a customer has subscribed to these specific features. Otherwise these features will run for every customer, even if they have not subscribed to them, and drive up costs significantly. However, the team found it challenging to create a simple, unified view of the features that each customer is subscribed to.

Nanit leverages microservices, which allow each team to iterate quickly and control their own business logic and databases. While microservices offered flexibility and autonomy individual teams, this architecture made it difficult to aggregate and combine customer data, since each service had siloed data. Nanit needed a way to effectively combine data from all these different microservice databases into a single view, ideally without complicated data processing logic.

Nanit initially leveraged an event-driven architecture, where each microservice exported data via Kafka topics. But the work required to pull data into a service and organize it was labor-intensive, error-prone, and inflexible.

Eddie Mishelevich, Senior Backend Developer at Nanit outlined the team’s challenges as follows: “For AI features, the majority of costs come from compute. Our goal was to optimize by performing processing only when necessary, ensuring all conditions in the feature flags were met. Different services possess the feature flags, and we exported this via Kafka topics. The process was difficult and complicated.”

After Materialize

Nanit required a simpler way to combine data across microservices in near real-time. They needed an always up-to-date view of what features a customer is subscribed to, so they can run expensive AI jobs only when needed. 

That’s where Materialize came in. One of Eddie’s team members had worked with Materialize before, and suggested the platform as a possible solution. Materialize is an operational data store that combines real-time data with full SQL support. Instead of building complex streaming architectures, teams can leverage Materialize to seamlessly publish and access high quality data products among microservices. 

With Materialize, Nanit was able to streamline its data architecture. Now the events and activities data flow through Kafka topics directly into Materialize. This allows the Nanit team to control the data transformations required to publish events and consume them using the simplicity and flexibility of SQL. That makes it much easier to leverage Kafka data streams across microservices, as opposed to requiring custom engineering work. 

“Materialize really simplified our data architecture,” Eddie said. “Now our teams could just use SQL, instead of implementing complicated logic. This made things much easier and much faster.”  

The ability to use SQL allowed many different teams in the company to iterate on top of real-time data streams. Because underlying database representations are shared as views in Materialize rather than through direct access, teams maintained loose coupling and could quickly add new capabilities without becoming blocked on data dependencies. For the first time, teams across the company could employ streaming data using a familiar programming language. 

Nanit used materialized views to aggregate and access data across all of its microservices. With Materialize, query results are incrementally and continually maintained. That means the views, and the queries that leverage them, are always up-to-date, while keeping costs down by requiring fewer compute resources.

Nanit used this operational data mesh as a centralized, always up-to-date source for customer feature subscriptions. This allowed the team to execute the proper AI features for each customer. In doing so, Nanit avoided paying extraneous compute costs for customers who did not subscribe to certain features.

“At Nanit, we didn’t have to reimplement our logic across all of our microservices,” Eddie said. “This streamlined our operations, and allowed us to avoid complex reimplementation.” 

Results

With Materialize, Nanit was able to build loosely coupled microservices using an operational data store. Materialize greatly simplified Nanit’s data architecture, allowing the team to regulate its expensive AI features using a single materialized view.

Materialize also democratized streaming data at Nanit. For the first time, teams could leverage real-time data with the highly accessible language of SQL. This allowed teams to build their own data products, and share them out with other entities in the company. 

Nanit ultimately built an operational data mesh, a decentralized architecture that enables microservice coordination while maintaining loose coupling. This allowed each team to manage its own database, while governing how its data is made available to the rest of the organization. The result was a more efficient product that saved significant costs while enabling parents to capture the most important moments of their young children.

Try Materialize Free