Chapter 5: Offloading operations with YugabyteDB Aeon

YugaPlus - Offloading Operations

YugaPlus has become one of the top streaming platforms, with hundreds of millions of people around the world spending countless hours watching their favorite movies, series, and live events. The YugaPlus team has mastered the art of scaling in the cloud, building a service that handles user traffic with low latency across multiple regions and tolerates all sorts of possible outages.

However, maintaining such a platform was not a trivial task. The engineering and infrastructure teams were spending a significant portion of their time just to keep the streaming platform running, secure, and up-to-date.

Eventually, the YugaPlus team found a way to spend more time on innovation. They transitioned to YugabyteDB Aeon, a DBaaS (Database-as-a-Service) that allowed them to offload the management, maintenance, and operations of their database cluster...

In this chapter, you'll learn how to do the following:

  • Deploy a YugabyteDB Aeon instance.
  • Connect the application to the YugabyteDB Aeon cluster.

Prerequisites

You need to complete Chapter 4 of the tutorial before proceeding to this one.

Start YugabyteDB Aeon cluster

YugabyteDB Aeon is a fully managed YugabyteDB-as-a-Service that allows you to run YugabyteDB clusters on Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP).

Before you can create a cluster in YugabyteDB Aeon, you need to add your billing profile and payment method, or you can request a free trial.

Follow these steps to deploy a YugabyteDB Aeon distributed cluster:

  1. Create a YugabyteDB Aeon account: https://cloud.yugabyte.com/signup

  2. Begin creating the cluster by clicking on the Create Cluster button.

  3. Choose the Set Up Distributed cluster option and follow the instructions in the wizard.

    • On the Network Access page, click on the Add Current IP Address button to add the address of your machine (where you run the YugaPlus application) to the IP Allow list.

    • On the DB Credentials page, download the file with your cluster credentials.

Spinning up and configuring your instance can take up to 5 minutes. During this time, the system is preparing everything you need to get started with your YugabyteDB Aeon instance.

Connect the application to YugabyteDB Aeon

After the YugabyteDB Aeon cluster is started, go ahead and connect the YugaPlus movie recommendations application to it.

First, rebuild the YugaPlus backend image to remove one of the database migration files created in the previous chapter:

  1. Use Ctrl+C or run {yugaplus-project-dir}/docker compose stop to stop the YugaPlus application containers.

  2. Rename the V2__create_geo_partitioned_user_library.sql file to skip_create_geo_partitioned_user_library.sql making sure it's not applied during the database migration phase.

    cd {yugaplus-project-dir}/backend/src/main/resources/db/migration/
    mv V2__create_geo_partitioned_user_library.sql skip_create_geo_partitioned_user_library.sql
    
  3. Navigate to the YugaPlus project dir:

    cd {yugaplus-project-dir}
    
  4. Rebuild the Docker images:

    docker compose build
    

Next, start the application connecting to your YugabyteDB Aeon cluster:

  1. Go to the YugabyteDB Aeon Settings tab and copy the public address of your cluster instance:

    Public Address

  2. Open the{yugaplus-project-dir}/docker-compose.yaml file and update the following settings:

    - DB_URL=jdbc:yugabytedb://${YOUR_YBM_PUBLIC_ADDRESS}:5433/yugabyte?sslmode=require
    - DB_USER=${YOUR_YBM_USER}
    - DB_PASSWORD=${YOUR_YBM_PASSWORD}
    
    • ${YOUR_YBM_PUBLIC_ADDRESS} - is the public address (host) of your YugabyteDB Aeon instance.
    • ${YOUR_YBM_USER} and ${YOUR_YBM_PASSWORD} - your database credentials from the file that you downloaded during the cluster configuration.
  3. Start the application:

    docker compose up
    

As soon as the yugaplus-backend container starts, it applies the database migration files to your cloud database instance. You can view the created tables in the Tables tab of the YugabyteDB Aeon dashboard.

Tables

Can't connect to YugabyteDB Aeon?

If the application fails to connect to YugabyteDB Aeon, ensure you've added your IP address to the IP Allow list.

Ask for movie recommendations one last time

With the YugaPlus backend operational and successfully connected to your YugabyteDB Aeon cluster, do one final search for movie recommendations.

  1. Go to the YugaPlus UI.

  2. Ask for movie recommendations:

Need to troubleshoot slow queries?

And, as one last hint, if it seems that some queries are running slow, navigate to the Performance -> Slow Queries dashboard of YugabyteDB Aeon to check if any require optimization.

Slow Queries

Congratulations! You've completed Chapter 5, the final chapter of the tutorial. Throughout this tutorial, you've learned essential capabilities of YugabyteDB that set you up for the next stage of your development journey.

Let's recap!

With that said, good luck building applications that scale and never fail! And don't forget to join our community, where you can get your questions answered and learn about the latest updates from the world of YugabyteDB.