Skip to main content

Add Data Services and Other Add-ons

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe Heroku’s ecosystem of plugins and third-party services.
  • List commonly used add-ons.
  • Install add-ons for a Heroku app.

Wei wants a better way to address the slow response times due to PDF generation beyond scaling infrastructure. She redesigns her Ursa Major Solar application to use worker dynos. In her new architecture, the web dyno pushes the incoming quote requests to a queue. A worker dyno picks up the request to generate the PDF file and emails it to the prospective customer.

Architecture diagram showing web dynos producing requests to send to Redis and a worker dyno consuming those requests.

While Wei knows she can add worker dynos by updating the app’s Procfile, still needs a reliable way to send background jobs to those dynos. She explores add-ons available for her app.

Add Functionality with Add-ons

Heroku add-ons are tools and services for developing, extending, and operating your apps. They’re components that support an app by adding features like data storage, monitoring, analytics, and data processing. These add-ons are maintained either by Heroku or a third-party provider. Add-ons allow the developers to focus on application logic, without the complexity of integrating external services.

The Elements Marketplace has a list of add-ons grouped by categories for expanding a Heroku app’s functionality. You can add them to an application through the Heroku Dashboard or the CLI.

There’s granular control over how to associate an add-on with an app. For example, you can have multiple instances of some add-ons attached to the same app. You can also attach the same instance of some add-ons to multiple apps.

Add-ons interact with a Heroku app in many ways, including:

  • Adding or updating config vars to the application
  • Reading from and writing to logs
  • Listening to events
  • Viewing app and app owner information

Heroku Add-ons Deep Dive

Wei explores the numerous plugins and integrations in the Elements Marketplace.

Whether she needs a database, a monitoring tool, or a real-time streaming service, there’s an add-on for that. These add-ons give Heroku apps extra features without the hassle of managing separate services.

Heroku add-ons come in various categories catering to the different needs of developers. Some common categories are:

  • Data stores: Options to store your data
  • Caching: Improves the performance of the application by caching data
  • Monitoring: Keeps an eye on your app’s performance
  • Security: Keeps the data safe
  • Analytics: Analyzes both application and business data

Heroku’s fully managed Postgres, Redis, and Apache Kafka data services help developers to get started faster and be more productive. Wei doesn’t have to worry about managing the infrastructure.

  • Heroku Postgres delivers an advanced open-source database as a trusted, secure, and scalable service.
  • Heroku Data for Redis enhances Redis, the world’s most popular key-value data store with a robust developer experience.
  • Apache Kafka for Heroku is a distributed commit log for fast and fault-tolerant communication between producers and consumers. Heroku’s Apache Kafka provides an enterprise-grade Kafka solution that scales seamlessly.

There are also third-party providers that have both free and paid add-ons in case Wei wants to test them out.

Install Add-Ons

Installing add-ons is easy with the heroku addons:create command or through the Heroku Dashboard.

Wei decides to use Heroku Data for Redis to store her background job requests.

Here’s an example of how to provision Redis with the CLI: heroku addons:create heroku-redis:mini.

Wei notes that the Redis Mini plan doesn’t include data persistence. She and her team decide that it’s an acceptable risk for their application. She decides to add it through the Heroku Dashboard instead of the CLI. After provisioning, Wei updates the app config vars with the Redis URL and channel name. She also decides on message retention policies based on application needs.

Heroku add-ons are like booster modules for your app, giving it extra features and functionality.

Put It All Together

With Redis added to her Heroku app, Wei also adds it locally and updates her Procfile to debug and test with heroku local. After fixing some bugs, she deploys her changes to Heroku with git push heroku main. She then scales her app down from running three Standard-1X dynos to one Basic web dyno and one Basic worker dyno. Her metrics show that her chosen infrastructure is sufficient for the app’s needs. Her new architecture helps Ursa Major save on operating costs while meeting the performance its customers expect.

Resources

Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기