perf: throttle sending websocket messages#400
Merged
maartenbreddels merged 1 commit intomasterfrom Nov 27, 2023
Merged
Conversation
This gives a better performance for starlette. enable with SOLARA_EXPERIMENTAL_PERFORMANCE=1
Contributor
Author
|
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
maartenbreddels
added a commit
that referenced
this pull request
Dec 16, 2024
.send_text called .send_bytes Bug introduced in #400, released since v1.25.0 This showed up when deploying in Modal with the error: ``` Traceback (most recent call last): File "/pkg/modal/_runtime/container_io_manager.py", line 764, in handle_input_exception yield File "/pkg/modal/_container_entrypoint.py", line 210, in run_input_async await generator_output_task # Wait to finish sending generator outputs. ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/pkg/synchronicity/async_wrap.py", line 29, in wrapper return await user_wrapper(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/pkg/synchronicity/async_wrap.py", line 29, in wrapper return await user_wrapper(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/pkg/synchronicity/async_wrap.py", line 32, in wrapper raise uc_exc.exc File "/pkg/modal/_runtime/container_io_manager.py", line 549, in generator_output_task messages_bytes = [serialize_data_format(message, data_format)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/pkg/modal/_serialization.py", line 346, in serialize_data_format return _serialize_asgi(obj).SerializeToString(deterministic=True) ^^^^^^^^^^^^^^^^^^^^ File "/pkg/modal/_serialization.py", line 217, in _serialize_asgi websocket_send=api_pb2.Asgi.WebsocketSend( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: expected bytes, str found ```
maartenbreddels
added a commit
that referenced
this pull request
Dec 16, 2024
.send_text called .send_bytes Bug introduced in #400, released since v1.25.0 This showed up when deploying in Modal with the error: ``` Traceback (most recent call last): File "/pkg/modal/_runtime/container_io_manager.py", line 764, in handle_input_exception yield File "/pkg/modal/_container_entrypoint.py", line 210, in run_input_async await generator_output_task # Wait to finish sending generator outputs. ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/pkg/synchronicity/async_wrap.py", line 29, in wrapper return await user_wrapper(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/pkg/synchronicity/async_wrap.py", line 29, in wrapper return await user_wrapper(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/pkg/synchronicity/async_wrap.py", line 32, in wrapper raise uc_exc.exc File "/pkg/modal/_runtime/container_io_manager.py", line 549, in generator_output_task messages_bytes = [serialize_data_format(message, data_format)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/pkg/modal/_serialization.py", line 346, in serialize_data_format return _serialize_asgi(obj).SerializeToString(deterministic=True) ^^^^^^^^^^^^^^^^^^^^ File "/pkg/modal/_serialization.py", line 217, in _serialize_asgi websocket_send=api_pb2.Asgi.WebsocketSend( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: expected bytes, str found ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This gives a better performance for starlette.
enable with SOLARA_EXPERIMENTAL_PERFORMANCE=1