Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream upstream response to client on demand #27

Open
wants to merge 4 commits into
base: add-example-config
Choose a base branch
from

Conversation

dvgica
Copy link
Owner

@dvgica dvgica commented Dec 13, 2019

Previously, the HttpProxy eagerly consumed the upstream response before streaming it to the client. This was necessary because it was never guaranteed that the client would consume the whole response and thus pull it through the connection slot. If the response was not consumed, the upstream would be backpressured and the connection slot was never released back to the pool. Eventually the API gateway would run out of connection slots.

In Akka HTTP 10.1.x, the new connection pool implementation automatically clears any slot that doesn't have its entity consumed. See response-entity-subscription-timeout for a description of this mechanism on https://doc.akka.io/docs/akka-http/current/configuration.html.

Streaming the response continuously, instead of eagerly consuming it and then streaming it to the client, is preferable from both a memory consumption and response latency point of view.

RC release for now, to go through testing.

@dvgica dvgica changed the base branch from master to add-example-config December 13, 2019 21:53
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.

1 participant