Prev Next

API / Microservices

Explain 12-Factor App methodology.

Building microservices using the 12-Factor App methodology ensures consistency, scalability, and ease of deployment in cloud environments.

  1. Codebase: One codebase tracked in revision control, many deploys. Each microservice should have its own repository to ensure independent lifecycle management.
  2. Dependencies: Explicitly declare and isolate dependencies. Use tools like Maven, Gradle, or Docker to ensure the app doesn't rely on pre-installed system libraries.
  3. Config: Store configuration in the environment. Keep credentials and resource handles in environment variables rather than hardcoding them in the source.
  4. Backing Services: Treat backing services as attached resources. Databases, caches, and queues should be interchangeable via configuration changes without modifying code.
  5. Build, Release, Run: Strictly separate build and run stages. A build is transformed into a release by adding config, which is then executed in the run environment.
  6. Processes: Execute the app as one or more stateless processes. Persist any data that needs to survive a restart in a stateful backing service like a database.
  7. Port Binding: Export services via port binding. The app should be self-contained and listen for requests on a specific port rather than relying on an external web server injector.
  8. Concurrency: Scale out via the process model. Handle increased load by adding more instances of the process (horizontal scaling) rather than just making one process bigger.
  9. Disposability: Maximize robustness with fast startup and graceful shutdown. Apps should be able to start or stop at a moment's notice without data loss or long delays.
  10. Dev/Prod Parity: Keep development, staging, and production as similar as possible. This minimizes "it works on my machine" bugs by using the same backing services across all environments.
  11. Logs: Treat logs as event streams. The app should write to stdout, leaving the aggregation and storage of those logs to the execution environment or specialized tools.
  12. Admin Processes: Run admin/management tasks as one-off processes. Scripts for database migrations or maintenance should run in the same environment and against the same release as the app.

Invest now in Acorns!!! 🚀 Join Acorns and get your $5 bonus!

Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!

Earn passively and while sleeping

Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.

Invest now!!! Get Free equity stock (US, UK only)!

Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.

The Robinhood app makes it easy to trade stocks, crypto and more.


Webull! Receive free stock by signing up using the link: Webull signup.

More Related questions...

Explain micro service architecture. Explain the benefits of microservices. Some of the challenges with Microservice. Explain spring boot in the context of microservices. What is Docker? What is Dockerfile? What is kubernetes? What are polyglot microservices? What is a service mesh? What is distributed tracing? Explain Trace and Span terminologies in distributed tracing. How do I decompose an application into services? What is Semantic monitoring in Microservices architecture? What is Melvin Conway's Law? What is Spring Cloud? What is a CDC in Microservices? What is PACT in Microservices Architecture? What is a Client Certificate? What is meant by Continuous Integration? What is Blue-Green Deployment Technique? Explain Monolithic vs SOA vs Microservices. What are the best practices to design Microservices? What is Domain-Driven Design (DDD)? Why do we need Domain Derived Design (DDD)? Different types of tests for microservices. What is API Gateway? Difference between Service orchestration and Service Choreography. What is APIGEE? Mention a few of the cross-cutting concerns that we need to implement for any microservice. Drawbacks of using microservices. Main components of Microservices. Explain the importance of reports and dashboards in microservices. Difference between API and microservice. What are the three commonly used tools for Microservices? How does a Microservice architecture work? Different strategies used in Microservices deployment. What does hystrix do? Explain the concept of message-driven microservices using Spring Boot and Apache Pulsar. What are the types of Microservice Communication? What is decentralized in microservices? Explain 12-Factor App methodology.
Show more question and Answers...

GraphQL Interview Questions

Comments & Discussions