gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 489 forks source link

Opera shows dramatic slow down over time #53

Open kanaka opened 13 years ago

kanaka commented 13 years ago

I just pushed a WebSockets latency tester into my websockify project.

I used it to generate some performance data comparing native WebSockets and web-socket-js on various browsers.

The tests/latency.html test page send a medium size timestamped packet every 10ms to the tests/latency.py test script which simply sends it back. When the page receives the packet it calculates the timestamp delta and updates the statistics.

As you can see between 9e7663771 and 20f837425d4 (plus the __handleEvents patch I posted earlier), latency of web-socket-js has improved significantly for firefox 3.6.10 and firefox 4.0 beta 9 (with native WebSockets disabled).

On the other hand Opera latency started out bad and has gone to worse. The initial latency stats out better (28ms vs 290ms) but Opera's latency (in both cases) increases dramatically over time. With the more recent web-socket-js, Opera sends the first 500 packets in 13 seconds. The last 500 packets (#2500 - #3000 or so) take 72s. I see the same behavior with noVNC (performance gets worse and worse in Opera).

In both the older and newer web-socket-js Opera latency appears to be exponentially increasing over time although the newer version has a steeper angle than the older. On the other hand, the older version with Opera 10.60 seemed to get into a state where Opera would eventually lock up. I haven't see that with the newer version of web-socket-js and Opera 11.

This seems to be indicative of a memory leak somewhere. My suspicion is that this may be an Opera problem since the same web-socket-js and Flash is used with firefox and does not show the problem. But the memory leak could be in web-socket-js or the FABridge somewhere and we just see it much sooner with Opera.

gimite commented 13 years ago

Thanks for the report. The change itself looks good because performance improved in most browsers. It would be nice to fix the Opera issue, though.

kanaka commented 13 years ago

With the move away from FABridge the slowdown with Opera is still there but it isn't quite as bad.

With my websockify latency test, the performance on Opera is now dropping in half every 2000 packets sent. In the previous version (with FABridge) the test performance would drop in half every 1000 packets. So the problem is still clearly there, but it's now half as bad ;-)

gimite commented 13 years ago

Hm, maybe issue of Opera itself...?

kanaka commented 13 years ago

Yes, since this doesn't seem to occur elsewhere I suspect a memory leak somewhere in the Opera to Flash plugin interface. web-socket-js is unique in the amount of data that is transferred back and forth between Javascript and Flash so I suspect web-socket-js is exposing a existing bug.

toyotabedzrock commented 13 years ago

Did you file a bug with Opera about this?

kanaka commented 13 years ago

I have filed a bug with Opera.