Skip to content

perf: throttle sending websocket messages#400

Merged
maartenbreddels merged 1 commit intomasterfrom
11-24-perf_throttle_sending_websocket_messages
Nov 27, 2023
Merged

perf: throttle sending websocket messages#400
maartenbreddels merged 1 commit intomasterfrom
11-24-perf_throttle_sending_websocket_messages

Conversation

@maartenbreddels
Copy link
Copy Markdown
Contributor

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

This gives a better performance for starlette.
enable with SOLARA_EXPERIMENTAL_PERFORMANCE=1
Copy link
Copy Markdown
Contributor Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@maartenbreddels maartenbreddels merged commit dd621c1 into master Nov 27, 2023
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
```
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