Search code examples
architecturemicroserviceshealth-monitoring

What is the benefit of having health check address on different port instead of using a different path?


When i search best practices for microservice architectures, sometimes a different port from application is used for health check address. Is this a good practice for microservices and what is pros and cons for this method?


Solution

  • There is no inherent benefit of making health checks on different port over different URL path - or vice versa.

    At the end, the port is just an abstraction of the underlying Operating System, routing traffic to different processes.

    What can matter is the concrete network infrastructure / setup in use: Firewall, load balancers, service discovery, etc.

    Maybe different ports are easier to configure as rules in the Firewall / IPS / Web Application Firewall? - but this is very implementation specific.

    To recap: both are fine. Use what makes your life easier, unless you discover some concrete need by your infrastructure / network setup.