# What's the ideal IdleTimeout of AWS ELB to avoid GatewayTimeout?

**URL:** <https://discuss.elastic.co/t/whats-the-ideal-idletimeout-of-aws-elb-to-avoid-gatewaytimeout/26971>\
**Category:** Elasticsearch\
**Created:** [August 6, 2015, 1:30pm UTC](https://discuss.elastic.co/t/whats-the-ideal-idletimeout-of-aws-elb-to-avoid-gatewaytimeout/26971 "2015-08-06T13:30:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Pepper](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexander_pepper/32/996_2.png) [@Alexander\_Pepper](https://discuss.elastic.co/u/Alexander_Pepper)\
**Post date:** [August 6, 2015, 1:30pm UTC](https://discuss.elastic.co/t/whats-the-ideal-idletimeout-of-aws-elb-to-avoid-gatewaytimeout/26971/1 "2015-08-06T13:30:20Z")

</div>

### Context

We are running an elasticsearch cluster with three nodes on AWS EC2. Each node uses the AWS Cloud Plugin to discover each other. In front of the cluster, we put a private elastic load balancer (ELB), so our rails apps can talk to that ELB to find the elasticsearch cluster. Currently we are using elasticsearch version `1.4.4`.

### Problem

Regularly - but not often - we receive status code `504` - `GatewayTimeout` from the ELB.

### Question

What's the ideal `IdleTimeout` of the ELB, which is used in front of an elasticsearch cluster?

AWS describes in its [Developer Guide](http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/config-idle-timeout.html) how to set the idle timeout. The only thing I found concerning `keep_alive` timeouts in elasticsearch is in this [ThreadPool source code](https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java#L112). But if I configure the `IdleTimeout` of the ELB to 29 seconds the `504` error still occurs.

So what's the `keep_alive` value of elasticsearch?

---

<div class="post-metadata">

**Author:** ![Alexander\_Pepper](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexander_pepper/32/996_2.png) [@Alexander\_Pepper](https://discuss.elastic.co/u/Alexander_Pepper)\
**Post date:** [September 1, 2015, 9:36am UTC](https://discuss.elastic.co/t/whats-the-ideal-idletimeout-of-aws-elb-to-avoid-gatewaytimeout/26971/2 "2015-09-01T09:36:52Z")

</div>

I received an answer in the IRC channel:

> the keepalive timeout is controlled by the kernel settings. ES doesn't control that. we only set the SO\_KEEPALIVE option on the socket. so it depends on the kernel settings.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:52pm UTC](https://discuss.elastic.co/t/whats-the-ideal-idletimeout-of-aws-elb-to-avoid-gatewaytimeout/26971/3 "2017-07-05T23:52:56Z")

</div>


