Too many sse connections hanging on a web page

What limits the number of SSE (Sent Events Server) connections?

I am working on a project using django / gunicorn / django-sse.

My project works fine when I limit the number of sse connections per page (5 works 6 freezes), this is not a big problem, because I use pagination, so I can limit the number per page. but I would rather have as much as I like.

My question is: is it the number of connections that slows it down, or is it the amount of data transferred?

the first problem, I think I can fix it by making them joint connections, but the second is likely to limit me a little more.

Any ideas that might be?

EDIT:

JS SSE Client Code:

function event(url, resource_name, yes, no, audio_in, audio_out, current_draw){
    /**
     * Listens for events posted by the server
     * 
     * Useful site for understanding Server Sent Events:
     *    http://www.w3.org/TR/eventsource/
     */
    var source = new EventSource(url);
    source.addEventListener("message", function(e) {
        resetTime(resource_name);
        data = updateStatus(e.data, yes, no, audio_in, audio_out, current_draw);
        document.getElementById(resource_name+"-in").src = data.audio_in_src
        document.getElementById(resource_name+"-in").alt = data.audio_in_alt
        document.getElementById(resource_name+"-out").src = data.audio_out_src
        document.getElementById(resource_name+"-out").alt = data.audio_out_alt
        document.getElementById(resource_name+"-current").innerHTML = data.current_draw + " A"
    });
}

in views.py

class ServerSentEvent(RedisQueueView):

    def get_redis_channel(self):
        """
        Overrides the RedisQueueView method to select the channel to listen to
        """
        return self.kwargs["resource_name"]

in urls.py

urlpatterns = patterns('',
                       url(r'^$',
                           views.Resources_page.as_view(),
                           name='resources_page'),
                       url(r'^(?P<resource_name>\w+)/$',
                           views.StatusPage.as_view(),
                           name='status_page'),
                       url(r'^(?P<resource_name>\w+)/sse/$',
                           views.ServerSentEvent.as_view(),
                           name='sse'),)
+5
3

sync worker gunicorn ( ), , .

sync , 2N + 1 ( N - ). SSE ...

while True:
    msg = "foo"
    yield msg
    sleep(1)

... /. , , . django_sse, , SSE.

, . gevent --worker-class=gevent , .

0

. , gevent , 6 .

. . , , ..

firefox : config, network.http.max-persistent-connections-per-server, . , 6 ( ) .

0

, , . Firefox "about: config", : {network.http.speculative-parallel-limit 6}, , .

.

0
source

All Articles