Motion logoCase study

Motion uses QuestDB for high-performance API analytics

Learn how fast-growing startup Motion applies QuestDB's intuitive libraries to monitor their customer's API usage.

Logo of Motion
Breafcase icon
Motion's Use Case
API analytics and dashboards
Globe icon
Motion's Industry
AI & Personal productivity
Flag icon
Motion's Deployment
QuestDB Cloud

Introducing Motion

Motion is an AI executive assistant that automatically organizes your busy schedule. Motion’s Intelligent Calendar takes meetings, tasks, to-do list, activities, and creates one perfect, optimized schedule to get it all done.

All this automation and intelligence generates significant amounts of useful data for Motion customers. For example, Motion lets customers track their API activity across different time horizons. Customers can then analyze this API usage in real time via a specialized, high performance time-series dashboard.

Motion logo

QuestDB made it 10x easier to build a real-time time-series graph visualizer for our users.

>Harry Qi
Co-Founder and CEO, Motion

The choice of a time-series database in the stack

The team at Motion had not used a time-series database. However, as they added more functionality to their dashboard and allowed their users to track a new set of metrics — in this case, API activity — over time, a specialized new database on their existing transactional PostgreSQL instance became a fast emerging requirement.

Motion needs to move rapidly to satisfy customer demand. As time-series data accumulated and requirements mounted, Motion's engineering team sought out a database focused on time series and analytics. Their software engineers first learned about QuestDB on Hackernews, and decided to try QuestDB Cloud. They were ingesting data and querying the database in a test environment in a few minutes.

  • Inserting data quickly: Speed is value. With QuestDB, getting started was quick via the open source docker image. They were ingesting data in less than 5 minutes with the official Python client library.
  • Developer experience and simplicity: What's a query language that the entire team can use immediately? SQL is the most popular programming language in the world, meaning the team can implement the solution without any learning curve. QuestDB provides robust SQL analytics.
  • Responsive dashboards: Showing the number of real-time API calls on a dashboard requires fast data querying capabilities. The database needs to cope with an increasing amount of data as the company scales with more customers which present larger and larger data querying requirements. The QuestDB Web Console provides fast dashboards, and connecting Grafana or other visualization engines is straight-forward.
  • Cost-effective solution: Picking a fully managed offering on the cloud is the preferred route, as Motion's DevOps team has limited time to spend on managing a database. However, pricing has to be fair and predictable. QuestDB Cloud provided the answer.
Motion logo

We use QuestDB to track API usage. For time-series data, QuestDB is a no-brainer, and the client libraries are very intuitive.

>Chander Ramesh
Head of Engineering, Motion

SQL queries to power time-series dashboards

Motion connects with a set of tools via native APIs. Consequently, each of Motion's customers can track the number of API calls made and downsample these results per time bucket, say one hour.

The team needed to express this in a simple fashion with SQL. QuestDB added time-series native SQL syntax for these situations. Downsampling the data, the process by which the amount of data is reduced by aggregating or averaging over larger time intervals or categories, was achieved with "SAMPLE BY".

One such query for the past day only would be:

SELECT
Timestamp AS hour,
SUM(count) AS requests_per_hour
FROM API_usage
WHERE timestamp >= dateadd('d', -1, timestamp('d', now()))
SAMPLE BY 1H ALIGN TO CALENDAR

There is no need to GROUP BY and ORDER BY, since the data is natively sorted by timestamp.

Overall content metrics, visualized via line graph

Monitoring API utilization over a fixed period

Transactional inserts via Postgres Wire Protocol

Motion leverages the Postgres Wire Protocol to do transactional inserts, which interacts with the front end of their application in NodeJS. The Posgres Wire Protocol was a familiar and straightforward option to get started. Harry and his team liked that PGwire also supports multiple concurrent connections simultaneously ingesting data in the same table.

QuestDB Cloud offered advantages to Motions' team. The goal was to minimize the time spent managing the database, so that the Motion team could spend more time building its software to delight their customers, rather than toiling away on database infrastructure.

Another aspect is ensure that spending is predictable and fair. The team realised that even a small instance with less than four CPUs could punch above its weight with QuestDB's software and accommodate their ingestion and query requirements.

QuestDB Cloud's hourly pricing pricing is a good fit for both production and staging instances, because each instance can be paused without any compute related spend during that time. This renders staging and dev instances much cheaper and guarantees pricing predictability for prod instances regardless of the amount of data ingested and/or queried.

Finally, monitoring the instance is also a very important aspect, with real-time dashboards tracking CPU and memory usage, as well as storage capacity:

A chart showing the QuestDB monitoring dashboard. Only 34.31% of the CPU is utilized, and it's all green.

Monitoring dashboard for Motion's QuestDB instance

QuestDB Cloud's hourly pricing pricing is a good fit for both production and staging instances, because each instance can be paused without any compute related spend during that time. This renders staging and dev instances much cheaper and guarantees pricing predictability for prod instances regardless of the amount of data ingested and/or queried.

The cherry on the cake is the new features which will soon be integrated into QuestDB Cloud as the company scales its data needs: High-performance cloud native replication and roles & permissions.

Ready to upgrade?


Download QuestDB and get started in minutes.