How Levven helps smart homes stay connected with CockroachDB & IoT
Remember when people’s vacuum cleaners and doorbells stopped working because a region of AWS went down? That won’t happen to anyone using our smart home products.
Levven had been in the appliance manufacturing industry for decades before “smart technology” paved the way for “smart homes”. When that happened we saw an opportunity to help make homes more affordable by designing and manufacturing smart home controls that reduce build costs. By eliminating the wire between the wall switch and the light we can offer consumers more eco-friendly home construction saving precious resources.
At Levven we added smart home controls manufacturing 5 years ago - but our cloud connectivity is new. Levven’s goal is to make homes more affordable to build, purchase, and operate for the masses with smart controls. In order to do that we need to build scale-out, low maintenance infrastructure that keeps the cost to the end user low, while also guaranteeing that our smart home controls will always work.
To help us address this IoT challenge we chose CockroachDB’s managed service offering: CockroachCloud. In this blog we’ll explain how we’ve built IoT application architecture that keeps smart devices available at all times.
Why Levven chose CockroachCloud
Our goal at Levven is to make smart home technology affordable to the masses. We do this by keeping our infrastructure overhead costs as small as possible.
Our requirements for the database were simple:
• The database should speak SQL
• The database should scale horizontally
• The database should be highly available
• The database should be cost efficient
Those requirements swiftly eliminated Oracle (price/scale issues), Postgres (scale), and MongoDB (I didn’t want to immediately jump to NoSQL solutions when there are fantastic relational solutions available). We did, however, spend some time considering Cassandra. But the complexity of managing the cluster and the machines would have added too much operational overhead for us. Because we’re a small team, aiming for a very low cost per customer, the lack of manual operations is an area where we need to spend efficiently.
We were interested in what CockroachDB could do from a scale and availability perspective. It was tremendously helpful that they offer a self-service managed version of CockroachDB (CockroachCloud). But the moment I knew for sure that we would use CockroachCloud was when I read about their active-active availability. That was my holy grail! I was thrilled to see that someone had solved it so well.
How Levven’s Smart Controls Work When the Internet is Down
In our industry there are two different data paths. One path depends on internet connection and the other depends on radio frequency (RF). We chose RF because we wanted to architect a system in which our smart home controls still work even when the internet does not. Here is a high-level diagram of our architecture. The “Levven Cloud” contains a lot of details like our load balancers, scaling groups, and such - but, for the purposes of this blog we’ve chosen not to go into all those details.
A light switch and the load controller are not internet connected. They are connected over a 900 megahertz RF network. The gateway is what bridges the controls with the cloud and access for mobile apps. It listens in on the radio communications and sends it to Levven’s servers. That is where the app connects to the home and can perform actions. What’s important to note here is that even without the internet all your home controls will continue to function intelligently. So if a region fails, the lightswitch will continue to work.
Check out the full case study above to learn more about how Levven is using CockroachCloud and how they plan to grow and scale the business moving forward. If you'd like to see another example of a customer using CockroachDB then check out this video interview with a DoorDash engineer: