What are the 12 factors of Microservices ?

Twelve-factor methodology

The twelve-factor app (12factor.net) is a methodology defined by the developers at Heroku for building platform-as-a-service apps that have these qualities:

Use declarative formats for setup automation, which minimizes time and cost for new developers joining the project

Have a clean contract with the underlying operating system, offering maximum portability among execution environments

Are suitable for deployment on modern cloud platforms, removing the need for servers and systems administration

Minimize divergence among development and production, enabling continuous deployment for maximum agility

Can scale up without significant changes to tooling, architecture, or development practices

You’ll see cloud native used interchangeably with twelve-factor app. Twelve-factor is the methodology, and cloud native refers to a computing environment and its tools. More details are available from the Cloud Native Computing Foundation.

The twelve-factor app is a set of best practices for creating apps that includes implementing, deploying, monitoring, and managing. It is a methodology that defines 12 factors that services should follow so that you can build portable, resilient apps for cloud environments. Web apps that deliver software-as-a-service (SaaS) are often cited as common examples of twelve-factor apps.

Twelve-factor apps have become a key yardstick by which components are measured to establish whether they are truly ready for cloud native deployment. It seems reasonable therefore that if you were to pursue lightweight integration, then you will want to use these principles there too to create a twelve-factor integration.

Twelve-factor apps can be implemented in any programming language and use any backing services such as database, messaging, and caching.

Finally, a twelve-factor app has characteristics that are ideal for developing individual microservices. The 12 factors ensure that an app can take advantage of the cloud infrastructure to deliver agility and scalability benefits. Although 12factor.net does not refer specifically to microservice architecture, it is typically used to define the appropriate characteristics for apps that are built as microservices. Apps built using the microservice approach typically need to integrate with data sources outside of the microservice architecture, for example, to integrate with systems of record built decades ago or services provided by a partner.

The twelve factors

To effectively design and build apps for the cloud, you should understand the twelve factors:

I. Codebase: One codebase tracked in revision control, many deployments
II. Dependencies: Explicitly declare and isolate dependencies
III. Config: Store configuration in the environment
IV. Backing services: Treat backing services as attached resources
V. Build, release, run: Strictly separate build and run stages
VI. Processes: Execute the app as one or more stateless processes
VII. Port binding: Export services via port binding
VIII. Concurrency: Scale out via the process model
IX. Disposability: Maximize robustness with fast startup and graceful shutdown
X. Dev/prod parity: Keep development, staging, and production as similar as possible
XI. Logs: Treat logs as event streams
XII. Admin processes: Run admin/management tasks as one-off processes

Post a Comment