Skip to content

Add support for idle_timeout_ms#1425

Merged
kflynn merged 1 commit into
emissary-ingress:masterfrom
AaronTriplett:atriplett1/idle-timeout
Apr 11, 2019
Merged

Add support for idle_timeout_ms#1425
kflynn merged 1 commit into
emissary-ingress:masterfrom
AaronTriplett:atriplett1/idle-timeout

Conversation

@AaronTriplett

@AaronTriplett AaronTriplett commented Apr 11, 2019

Copy link
Copy Markdown

Description

Adds support for Envoy's idle_timeout configuration with an idle_timeout_ms mapping attribute. When set, this value overrides the Envoy connection manager wide stream_idle_timeout for said route.

idle_timeout is used to bound the amount of time a request’s stream may be idle. This is especially important for long-lived connections (ex: gRPC) that currently get terminated after 300 seconds of inactivity due to the default value of stream_idle_timeout in envoy.

Today, only values greater than 0 are supported (on the current envoy version) due to a bug in Envoy's config validation logic. In the future, setting this value to 0 should completely disable the route’s idle timeout, even if a connection manager stream idle timeout is configured. This has been fixed here: envoyproxy/envoy#6500 and should automatically work once released and the ambassador-envoy-alpine image is updated.

Example mapping for 1 hour idle timeout:

---
      apiVersion: ambassador/v1
      kind: Mapping
      name: grpc_test_mapping
      grpc: True
      prefix: /cf.Echo/
      rewrite: /cf.Echo/
      timeout_ms: 0
      idle_timeout_ms: 3600000
      service: cfservice.intlgntsys-cui-conversation-framework-usw2-ppd-dev:9090

Testing

  • Open long-lived gRPC Stream from client to service through Ambassador/Envoy.
  • Let connection idle (no active RPC) for 5 minutes
  • Observe connection termination promptly at 300 seconds / 5 minute mark (Envoy stream_idle_timeout default).
  • Set idle_timeout_ms attribute on the gRPC service's Ambassador Mapping to 3600000 (1 hour)
  • Open long-lived gRPC Stream from client to service through Ambassador/Envoy.
  • Let connection idle (no active RPC) for 60 minutes
  • Observe connection termination promptly at 1 hour mark.

Todos

  • Tests
  • Documentation

@kflynn

kflynn commented Apr 11, 2019

Copy link
Copy Markdown
Member

Looks good! Normally we'd need automated tests, too, but the test suite needs some work to handle timeouts right now, so I'm going to go ahead and land this one. Thanks!

@kflynn kflynn merged commit c159844 into emissary-ingress:master Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants