Debugging and fault-finding

As you can see, we said debugging and maintenance will be easier in a microservice. However, it also becomes a challenge when there is communication between these services and one's output is effecting another.

When we have different services, we need a way for services to communicate with each other. Services communicate with each other in two ways: through HTTP calls or through messages. Here, by messages we mean using some sort of messaging queues such as RabbitMQ and so on. In the case of message passing, it can be very difficult if there is some bug or something unexpected is happening. Since it is not one service and every service is working based on the previous service's output, it is difficult to know where the problem is.

So, a way to tackle this is to write tests thoroughly. Because if it is making sure that every service's test cases are written and testing whether they are working fine, then it can fail before deployment.

However, this is not always the case. It is because there is not one service. Many services are interacting and sometimes, there is a problem in the live environment and you want to debug and fix it. For this purpose, logs are very important. However, again, this is a distributed environment. So, what can we do? Here are few things that you need to ensure you do with logs.