# Consul service mesh, clarification around request timeout

**URL:** <https://discuss.hashicorp.com/t/consul-service-mesh-clarification-around-request-timeout/62123>\
**Category:** Consul\
**Tags:** connect\
**Created:** [January 26, 2024, 1:42pm UTC](https://discuss.hashicorp.com/t/consul-service-mesh-clarification-around-request-timeout/62123 "2024-01-26T13:42:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbd](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/dbd/32/29957_2.png) [@dbd](https://discuss.hashicorp.com/u/dbd)\
**Post date:** [January 26, 2024, 1:42pm UTC](https://discuss.hashicorp.com/t/consul-service-mesh-clarification-around-request-timeout/62123/1 "2024-01-26T13:42:54Z")

</div>

Hi.  
I’m running a Nomad/Consul/Vault cluster for a number of services, with service mesh used for almost all inter-service communications. Things mostly works, but I have some problems when using HTTP services through the mesh (with Protocol = “http” in service-defaults) and requests taking more than the default limit of 15s.

My HTTP client keeps getting “upstream request timeout” error on some queries. Looking at the docs, there’s a lot of place where request timeout can be configured, but it’s never clear which settings affects which timeout, as there are several components involved :

- Initial client to local envoy
- Envoy to envoy
- Envoy to final server

The available settings

- local\_request\_timeout\_ms set either in a proxy-defaults config, like

```hcl
Kind = "proxy-defaults"
Name = "global"
Config {
  local_request_timeout_ms = 0
}

```

or in the job

```hcl
      connect {
        sidecar_service {
          proxy {
            config {
              local_request_timeout_ms = 0
            }
        }
      }

```

- RequestTimeout in a service-resolver configuration, like documented [here](https://developer.hashicorp.com/consul/docs/connect/config-entries/service-resolver#requesttimeout)
- RequestTimeout in a service-router configuration, like documented [here](https://developer.hashicorp.com/consul/docs/connect/config-entries/service-router#routes-destination-requesttimeout)

Can anyone clarify a bit how, and where to configure a bigger request timeout (which of those configuration should be applied, and on the source service, or the destination service)

---

<div class="post-metadata">

**Author:** ![Ranjandas](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@Ranjandas](https://discuss.hashicorp.com/u/Ranjandas)\
**Post date:** [January 29, 2024, 12:11am UTC](https://discuss.hashicorp.com/t/consul-service-mesh-clarification-around-request-timeout/62123/2 "2024-01-29T00:11:58Z")

</div>

Hi @dbd,

To answer this question, let’s take two services, `frontend` and `backend`. To avoid getting `upstream request timeout`, you will have to apply the timeout configurations in two places.

1. Envoy to Envoy: This can be configured using a service-router or service-resolver for the upstream service. So in our example, we should apply it for the `backend` service. The simplest option is to have a service-resolver as shown below.

2. Envoy to the final server (`local_app`): In addition to the above, it is important that the `local_request_timeout_ms` is adjusted, as this is where the delay is coming from. Applying this would configure the upstream services (`backend) envoy to wait for the application.

It should be noted that the request timeout will depend on the minimum value set to one of these.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![dbd](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/dbd/32/29957_2.png) [@dbd](https://discuss.hashicorp.com/u/dbd)\
**Post date:** [January 29, 2024, 8:06am UTC](https://discuss.hashicorp.com/t/consul-service-mesh-clarification-around-request-timeout/62123/3 "2024-01-29T08:06:35Z")

</div>

Thanks, so everything has to be configured on the backend service. I’ll take another look at what I did because I think I did what you explain, but still have upstream request timeout with requests in the ~15s range

---

<div class="post-metadata">

**Author:** ![dbd](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/dbd/32/29957_2.png) [@dbd](https://discuss.hashicorp.com/u/dbd)\
**Post date:** [January 30, 2024, 8:16am UTC](https://discuss.hashicorp.com/t/consul-service-mesh-clarification-around-request-timeout/62123/4 "2024-01-30T08:16:18Z")

</div>

Everything is working as expected, thanks for your clarifications. My problem was with webservice calls to a second backend, for which no service-resolver was configured, so using the default 15s timeout. Once identified and fixed, I get the desired behavior.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/hashicorp/original/1X/79bf76adfd92a75631996933098f9ce29d37abf3.svg) [@system](https://discuss.hashicorp.com/u/system)\
**Post date:** [May 21, 2024, 4:34pm UTC](https://discuss.hashicorp.com/t/consul-service-mesh-clarification-around-request-timeout/62123/6 "2024-05-21T16:34:28Z")

</div>

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.
