Yaffle / EventSource

a polyfill for http://www.w3.org/TR/eventsource/
MIT License
2.11k stars 338 forks source link

event source polyfill performance issue in IE11 #108

Open bhaumikbarad opened 6 years ago

bhaumikbarad commented 6 years ago

We are using below technologies in our Application,

  1. AngularJS
  2. .Net
  3. SSE

Application is compatible with Chrome browser. However to support in IE 11 and Edge browser we have included event source polyfill at client side. Below are our observation in IE 11 after including event source polyfill at client side.

  1. Performance is very low whlie loading the page in IE 11 compare to Chrome.
  2. When we do multiple client request, memory utilization is drastically increasing more than 1 GB (observed in task manager) and system is getting hang.

Please help us with below queries,

  1. event source polyfill is the reason to slow down the performance in IE 11 ?
  2. what are the disadvantages of event source polyfill in IE 11?
  3. Is there any other settings we need to do in IE 11 ?

Thanks, Bhaumik

Yaffle commented 6 years ago

How much data do you transfer inside of this connection?

bhaumikbarad commented 6 years ago

With multiple request, data is in KBs (approximate 100 KB).

Yaffle commented 6 years ago

Seems, yes, it may have some performance problems

Yaffle commented 6 years ago

Edge supports fetch API with streaming response body. Probably it will work faster. I have a code for this polyfill to use it. But didn't test it.

Yaffle commented 6 years ago

@bhaumikbarad , please try a new version which uses Fetch API as a transport in Edge

adamtaylor13 commented 4 years ago

Sorry to hijack this thread, but it feels like my issue may closely related. We're noticing that smaller message will come through, but certain messages do not. I'm at a loss as to what could possibly cause this. Is it possible that messages are too large and are being dropped altogether?

Yaffle commented 4 years ago

@adamtaylor13 , there is nothing in the source of the polyfill to drop large messages, it could be a bug or a browser bug in the underline browser APIs. What is the browser you are using and how large are the messages?

adamtaylor13 commented 4 years ago

Holy speedy reply batman, well IE 11 is the browser that's giving me the issues. Turns out it's actually only about~24Kb so I'm actually a little surprised how small it was. It's so weird because certain messages get back absolutely fine, but for whatever reason, this call in particular chokes.

I'll also note that everything works fine in Chrome. (Typical)

Yaffle commented 4 years ago

would be nice to debug this - to see if it is a browser bug or a bug in the library if it a browser bug - may be the progress event is not fired like in #91 ,

      timeout = setTimeout(function () {
        onTimeout();
      }, 0);

This code in the polyfill is trying to check xhr.responseText one more time to workaround this. May be, it is not good enough.

Yaffle commented 4 years ago

@adamtaylor13 , do you have a stream to reproduce? (with CORS headers preferably)

adamtaylor13 commented 4 years ago

@Yaffle Sorry for the delay.. He's the most bizarre part of all of this. I was finding all this information out while testing on CrossBrowserTesting, but when I looked on BrowserStack—NO PROBLEM.

I cannot fathom what might be different between the 2 processes.

Yaffle commented 4 years ago

@adamtaylor13 , it seems, there is nothing I can do - the polyfill uses a timer to check XMLHttpRequest#responseText. Try in Edge.