top of page

Understanding Backing Services


ree

Making Every Service an Integral Piece of Your App Puzzle

When it comes to app development, especially when we follow the 12-factor app methodology, there's a concept that stands out for its importance and utility: Backing Services. These are essentially the external services your application relies on to operate smoothly. Think of them as the gears and cogs in a machine, each playing a critical role in the overall functionality.

"Think of each service your app uses as a piece of a puzzle. When they fit together just right, your application runs like clockwork."

Breaking Down Local and Cloud Services

When we talk about backing services, we're referring to a wide range of support mechanisms the app needs, like databases (MySQL, CouchDB), message queues (RabbitMQ), email services (Postfix), and caching systems (Memcached). But where do these services live? Some, like databases, might be managed on the same network as your app, overseen by your own team. Others, such as email delivery services (Postmark), monitoring tools (New Relic, Loggly), or storage (Amazon S3), are hosted elsewhere, provided by third-party vendors.


The beauty of the 12-factor app approach is in how it treats all these services: as attached resources. It doesn't matter if a service is managed in-house or by an external provider; to the app, they're all equally accessible components, plugged in to add value.


Swapping Services Without a Hitch

One of the smartest aspects of this approach is how services are connected to the app—through configuration settings. This setup means if you need to switch from a local MySQL database to Amazon RDS, you don't have to rewrite your app's code. Just update the configuration, and voilà, your app is now talking to a new database.

This flexibility is a game-changer, ensuring your app can adapt to new requirements or improved technologies without a massive overhaul.


From Theory to Practice

Let's imagine an app that's currently using a local file storage system for storing user uploads. Suddenly, you decide it's time to move to cloud storage with Amazon S3 due to its scalability and reliability. In a traditional setup, this might require significant code changes. However, in a 12-factor app, you simply update the configuration with the new service's details. The app continues to operate, oblivious to the change, because it treats all backing services as plug-and-play components.


ree

This flexibility also applies when dealing with multiple instances of the same service, like when sharding databases. Each shard is considered an independent resource, reinforcing the idea that services are modular and interchangeable parts of the application ecosystem.



Bringing It All Together

In practice, a well-architected 12-factor app could be connected to a myriad of services: databases for data storage, message queues for background jobs, email services for communication, and caching systems for performance enhancement. Each service is a standalone resource, easily replaceable or upgradable without impacting the core application.


The 12-factor methodology promotes a seamless, flexible approach to integrating and managing backing services, ensuring that applications remain robust, adaptable, and easy to maintain.


To bring these concepts to life, let's visualize an application's architecture:

  • Database Services: MySQL for user data, Redis for caching.

  • Messaging Queue: RabbitMQ for handling background tasks.

  • Email Service: Postfix for sending transactional emails.

  • File Storage: Initially local storage, now migrated to Amazon S3 for scalability.


ree

Each of these services is configured to be easily swapped or scaled without code changes, demonstrating the power and flexibility of treating backing services as attached, interchangeable resources in the 12-factor app methodology.


Comments


The Occasionally Amazing Newsletter!

Thanks for submitting!

© 2024 visakhunni.com

bottom of page