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

switch default gateway server from hypercorn to twisted #10703

Merged
merged 1 commit into from May 2, 2024

Conversation

alexrashed
Copy link
Member

@alexrashed alexrashed commented Apr 22, 2024

Motivation

@thrau added twisted as supported gateway server with #9834. Since then this was tested by selected users, and it turned out to be a great server. In reduced complexity and improved performance.

Changes

  • Switches the default for GATEWAY_SERVER from hypercorn to twisted.

Testing

  • Since the gateway is the foundation for every single request served in LocalStack, this change has an insane coverage. If all our tests are 💚, we should be good to go!
  • We also need to execute tests for our downstream projects, to make sure other projects don't break.

TODO

  • Execute tests in downstream projects.
  • Fix issues with streaming responses in our downstream usage.

@alexrashed alexrashed added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Apr 22, 2024
@alexrashed alexrashed added this to the 3.4 milestone Apr 22, 2024
@alexrashed alexrashed requested a review from bentsku April 22, 2024 06:59
@alexrashed alexrashed self-assigned this Apr 22, 2024
@alexrashed alexrashed requested a review from thrau as a code owner April 22, 2024 06:59
Copy link

github-actions bot commented Apr 22, 2024

S3 Image Test Results (AMD64 / ARM64)

  2 files    2 suites   3m 0s ⏱️
398 tests 346 ✅  52 💤 0 ❌
796 runs  692 ✅ 104 💤 0 ❌

Results for commit 3a53be3.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 22, 2024

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 37m 39s ⏱️ + 6m 37s
2 922 tests ±0  2 632 ✅ ±0  290 💤 ±0  0 ❌ ±0 
2 924 runs  ±0  2 632 ✅ ±0  292 💤 ±0  0 ❌ ±0 

Results for commit 3a53be3. ± Comparison against base commit 0aebc1e.

♻️ This comment has been updated with latest results.

@alexrashed alexrashed marked this pull request as draft April 22, 2024 13:39
@alexrashed alexrashed modified the milestones: 3.4, 3.5 Apr 22, 2024
@alexrashed
Copy link
Member Author

FYI: Changed the PR to draft and changed the milestone to 3.5, because we found some issues with downstream projects.

@thrau
Copy link
Member

thrau commented Apr 24, 2024

Following up on our discussion @dfangl, I found that there are at least two checks in the stack trace whether the data buffer is empty or not:

The switch makes perfect sense to me. Why write anything when there's no data? While we could forego these conditions, I found no way to trigger a write buffer flush. I found this SO post on the topic, where one of the maintainers also suggest you shouldn't be talking to the reactor in this way in the first place.

So in summary I would say this is not a problem with the server, but rather in the particular downstream implementation that relies on the assumption that a buffer will be flushed when you write empty bytes to it.

My recommendation is therefore to fix the particular downstream implementation (for instance by sending a type of "stream initiated" event that can be ignored by clients) to make it more compatible with different IO frameworks.

@alexrashed alexrashed marked this pull request as ready for review May 2, 2024 07:57
@alexrashed
Copy link
Member Author

alexrashed commented May 2, 2024

@thrau @bentsku The issues in our downstream projects have been addressed by @dfangl (in a backwards compatible manner 🦸🏽) and there have been multiple runs validating that the fix works properly.
In my opinion this PR is ready to be merged! 🥳 🚀

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice to see everything addressed, thanks a lot for fixing it! 🚀

Can't wait to see all the nice performance increases showed in #9834!

@alexrashed alexrashed merged commit 10cab48 into master May 2, 2024
41 checks passed
@alexrashed alexrashed deleted the switch-to-twisted branch May 2, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants