Powering an Operational Data Mesh at Nanit

Nanit

Summary

Nanit leveraged Materialize to build an operational data mesh based on 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 and growth 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 built an operational data mesh, a decentralized architecture built on top of microservices, that allowed each team to govern its own data and database. 

While this offered flexibility for individual teams, this decentralized architecture made it difficult to aggregate and combine customer data, since each microservice served as its own data silo. Nanit needed a way to effectively combine data from all these different microservice databases into a single view. 

In this event-driven architecture, 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 features 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 platform that combines real-time data with full SQL support. Instead of building complex streaming architectures, teams can leverage Materialize’s SaaS data store to seamlessly build real-time microservices. 

With Materialize, Nanit was able to streamline its data architecture. Before Materialize, Nanit’s microservices pushed data through to Kafka topics, including individual events and activities. This allowed for each service to access and harness data from the other services. But this process required Nanit to write complicated logic to process the Kafka data on the backend.  

Now the events and activities data flow through Kafka topics directly into Materialize. This allows the Nanit team to control the data 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 as a form of business logic allowed many different teams in the company to iterate on top of real-time data streams. As a popular programming language, SQL enabled business teams to change their own logic, regardless of what other teams did. 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 maintained in real-time via change data capture, as soon as data is created or modified. This allows the materialized view to compute data as it arrives. That means the query output is always up-to-date, while keeping costs down by requiring less compute resources.

Nanit used this materialized view 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 a SaaS 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 built an operational data mesh with Materialize, composed of loosely coupled microservices that shared always up-to-date information. 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