Skip to content

Optimizing resource utilization: Rethinking streamed_events for user requests #1

Description

@alosultan

For each new request to events view, a new instance of streamed_events coroutine will be created, executed separately in the event loop. This means that if there are two requests from different users, two separate instances of the coroutine will be created, operating independently from each other. Each open connection will consume a portion of server resources. If you have 1000 users visiting your website, that will result in 1000 instances of the streamed_events coroutine, each executed separately in the event loop.

I do not believe this is good practice. In my opinion, it is better to use django-channels for persistent connections, and StreamingHttpResponse for long-lived connections.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions