VOOZH about

URL: https://iot.scylladb.com/stable/getting-started

⇱ Getting Started with CarePet: A sample IoT App | ScyllaDB Docs


ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Docs ScyllaDB IoT Example Documentation Getting Started with CarePet: A sample IoT App

Getting Started with CarePet: A sample IoT App

Introduction

This guide will show you how to create an IoT app from scratch and configure it to use Scylla as the backend datastore. It’ll walk you through all the stages of the development process, from gathering requirements to building and running the application.

As an example, you will use an application called CarePet. CarePet allows pet owners to track their pets’ health by monitoring their key health parameters, such as temperature or pulse. The application consists of three parts:

  • A pet collar with sensors that collects pet health data and sends the data to the datastore.

  • A web app for reading the data and analyzing the pets’ health.

  • A database migration module.

You can use this example with minimal changes for any IoT application.

Architecture

  • migrate - Creates the CarePet keyspace and tables.

  • sensor - Generates pet health data and pushes it into storage.

  • server - REST API service for tracking the pets’ health state.

👁 Build your first ScyllaDB Powered App - Raouf

Requirements

Prerequisites for Deploying the Application

The example application uses Docker to run a three-node ScyllaDB cluster. You can also use Scylla Cloud as your database. Claim your free Scylla Cloud account here.

Use Case Requirements

Each pet collar has sensors that report four different measurements: temperature, pulse, location, and respiration.

The collar reads the measurements from the sensors once per second and sends the data directly to the app.

Performance Requirements

The application has two performance-related parts: sensors that write to the database (throughput sensitive) and a backend dashboard that reads from the database (latency sensitive).

  • This example assumes 99% writes (sensors) and 1% reads (backend dashboard).

  • SLA:

    • Writes: throughput of 100K operations per second.

    • Reads: latency of up to 10 milliseconds for the 99th percentile.

  • The application requires high availability and fault tolerance. Even if a ScyllaDB node goes down or becomes unavailable, the cluster is expected to remain available and continue to provide service. You can learn more about Scylla high availability in this lesson.

Deploying the Application in ScyllaDB Cloud

Using the ScyllaDB Cloud Terraform provider, you can easily spin up new ScyllaDB Cloud clusters. Complete this tutorial quicker by creating a new t3.micro cluster (the smallest instance) in ScyllaDB Cloud. Go to Deploy in ScyllaDB Cloud with Terraform for instructions.

Build the Application with Your Programming Language

Additional Resources

Future Work

  • Add Sizing

  • Add Benchmarking

  • In a real-world application, it would be better to aggregate data in an internal buffer and send it once a day to the application gateway in a batch, implying techniques such as delta encoding. It could also aggregate data at a lower resolution and take measurements less frequently. The collar could notify the pet’s owner about suspicious health parameters directly or via the application.

  • Add location tracking info to send alerts when the pet enters/leaves safe zones using known WiFi networks.

  • Use the measurements to present to the pet owner health alerts, vital signs, sleeping levels, activity levels, and calories burned.