Microservice architecture is an approach to building software systems where an application consists of small, isolated services, each responsible for a specific business task, developed and deployed independently of others.
Advantages:
Disadvantages:
Example REST mockup of a microservice in Python (Flask):
from flask import Flask, jsonify app = Flask(__name__) @app.route('/user/<int:user_id>') def get_user(user_id): return jsonify({"user_id": user_id, "name": "Ivan"}) if __name__ == "__main__": app.run(port=5001)
Key features:
Can microservices work on a single database?
This is permissible during the migration phase from a monolith, but it contradicts the ideology, as each service should store its own data separately to minimize dependencies and ensure independent development.
Is it mandatory to use Docker for microservice architecture?
No, Docker facilitates deployment and isolation, but microservices can be implemented without containerization, for example, using virtual machines or even separate physical servers.
What happens if the API contract between services is broken, but the CI/CD pipeline is all green?
A failure in the API contract will lead to interaction errors between services, which can only be detected through integration tests. A green build in CI/CD does not guarantee that different versions of services are compatible with each other.