Microservices is a particular variant of Service Oriented Architecture Pattern. A System is broken down into a set of micro applications, each one independent of the other and communicating each one to other by REST, gRPC, Sockets, etc.

An application can be considered a Microservice if it only works with one Entity, lets say Vendors Service, that handles Create, Update and Delete Vendors, or if it only handles one process, lets say an Email Service, that handles sending emails. Other important characteristic is that a Microservice has it own micro DB Server. Docker and Kubernetes are the most common environments to implement this Pattern.

A typical PHP REST Microservice has these 3 docker containers:

  • Nginx Web Server Container
  • PHP Container
  • DB Server Container

When working locally, we use docker compose for container orchestration and each Microservice's Nginx container listening in a different port. When working on the cloud, we use Kubernetes as container orchestrator and a Ingress Controller that will take care of sending the request to the appropriate Microservice. In the cloud, these 3 containers are organized in a Pod.

 

Caching is an important concept in web development that helps to improve the performance of web applications. Symfony 5+ provides various caching mechanisms that you can use to improve the performance of your application, mostly for requests that will require lot of processing. This helps in reducing response times ,but a the same time in reducing system resources usage, allowing the System to be able to serve many more client requests. A good caching strategy is crucial for improving Application performance and reducing costs in infrastructure.

Prerequisites:

 

 Step 1. Install Symfony Cache component.