Currently all my microservices use HTTP to communicate to each other. I know Consul Connect/Envoy uses TCP as default protocol so should I use TCP as default or have to config each service use HTTP?
Is there any pros/cons when use TCP vs. HTTP?
Currently all my microservices use HTTP to communicate to each other. I know Consul Connect/Envoy uses TCP as default protocol so should I use TCP as default or have to config each service use HTTP?
Is there any pros/cons when use TCP vs. HTTP?
Using TCP as the service protocol allows you to proxy any TCP-based service, not just HTTP.
Configuring a service’s protocol as HTTP allows you to utilize Consul’s layer 7 traffic management features such HTTP path-based routing, traffic splitting, canary or A/B deployments, etc. Envoy also emits more detailed metrics for HTTP-based services compared to TCP, which is useful if you are utilizing Consul’s observability features.
You can create a single proxy-defaults
configuration entry which sets the default protocol to http
for all services. If you have a few services which need to use TCP, you can override the global default by creating a service-defaults
config entry for each service.