- Home /
Severe performance problem with 2 instances of web player
The nature of this discussion has gone beyond the scope of the Q&A format, so I have created a forum topic to discuss it further. Please continue the discussion there. If & when we have a more conclusive answer I shall post it here.
I'm not sure if this is a question for Unity Answers or if it's a bug report, but I thought I'd verify here before I submit a bug.
Basically we have a small unity build that acts as a small element on a web page (246x246 pixels). It's neat and works beautifully and takes the whole website up a level. The idea is to have several of these scattered on each page. These are very simple small projects, basically replacing several static images with rotating 3D models.
When there was only one instance of the unity web player on the page, the performance was reasonable. However once I introduced a second one, we got a huge performance problem all of a sudden.
The problem occurs when scrolling the browser window. When not scrolling both instances seem to perform reasonably and CPU usage is reasonable. If scrolling slowly the scrolling is choppy and there are many small freezes. When scrolling fast the CPU usage goes through the roof and the browser hangs or crashes.
I tried Flash instead, so exact two scenes exported to Flash placed in the exact same places on the page (2 instances) - performance wasn't perfect but there were not huge CPU usage spikes or hangs. I've tried removing all JS from the page (hardcoded the embedded HTML result) - no difference.
So is there some known problem / is it likely something in our project ? Or is this likely to be some bug in Unity?
[1]: http://unitywebplayertest.abiri.org/
I am also interested by this question. I use Firefox and I already noticed that running 2 Unity instances, even in different browser tabs will cause major lag. Your 4 instances test is enough to get my browser hanging at work, and we have bombs for computers, so any hint to correct the issue would be greatly appreciated :)
@BY0LOGIC Thanks for the feedback - I'm glad to learn it's not just me! :-) Can you provide the details of your spec / what browser(s) you've used? (but please do so in the new forum topic I created)
Answer by amirabiri · Mar 09, 2012 at 12:26 AM
OK I think something is very wrong here... I just performed a very simple check and the results are frightening. I created a very simple project with a simple spinning cube, built it as a web player and uploaded to a little test page I created.
The result is that with 1 instance the browsers sort of perform reasonably. Scrolling is choppy but they survive.
However with 4 instances of the player on the page, when using the mouse to scroll, FF 3.6 and IE 8 perform badly but barely hang in there. Chrome (17.0.963.78 m) totally hangs. In fact I couldn't even begin to scroll the page in Chrome, it didn't respond.
I have uploaded the test to my server so that perhaps other people can try it and report the performance they are getting. I will also submit this as a bug report to the Unity team now.
Warning: This test can cause your browser to hang! Before you click this link make sure any work you have open in your browser is saved!
Answer by Bunny83 · Mar 09, 2012 at 01:36 AM
I've tested both versions without major problems. The one-player-version runs fine. The four-player-version also runs fine, but when scrolling it gets a little bit choppy, but not too bad. CPU usage usually is around 1-2% but when scrolling it raises to 35-40%. I have a quite old PC (Pentium D dual core 3GHz, 4GB ram, Nvidia 8600 GTS [256MB i guess :D], 32Bit-WindowsXP, FF 4.0 [i don't use FF's plugin-container!] )
I would expect a little hiccup due to device-context-repositioning. Since Unity is hardware accelerated, every plugin uses a hardware device context which isn't made for being moved around ;)
No, I don't use chrome. I love a lot of google's services (web search, maps, translator, youtube, code) except chrome ;)
$$anonymous$$aybe some day i switch, but my webbrowser isn't my most important application ;)
Tried on Firefox 10.0.2, Chrome 17.0.963.78 m and even as part of the remaining 1% of the world I tried on Explorer 9. I don't have Opera. And it worked on all 3, a little stopping in the middle but no big issue. For my specs, I have i2 duo 2,66, 4GB, GE force 7300, windows7 64bit. So not an amazing machine.
@Bunny83 That's fair enough, but when building a website we need it to support all major browsers, and Chrome is one of them. Plus I personally found the performance on Firefox to also be unacceptable (3.6 in my case).
@fafase Thank you for the feedback :-) Your chrome version is identical to $$anonymous$$e which implies that it might be environment-specific.
Answer by amirabiri · Mar 10, 2012 at 12:56 AM
I have updated the test page to include a 12-instances page, and also started a results table based on the reports submitted here.
Click here to go to the test page.
The nature of this discussion has gone beyond the scope of the Q&A format, so I have created a forum topic to discuss it further. Please continue the discussion there. If & when we have a more conclusive answer I shall post it here.
Even though it's possible to run several web players inside one page, its purpose isn't whilst perfor$$anonymous$$g well. If you want several web players on one page just go with a more reasonable approach where you inactivate the ones that isn't used. The web player will always perform at its best as a singleton - at fullscreen loaded from a website, as inline plugins demands much more attention to render.
As I've explained elsewhere activating / inactivating isn't an option for us since we want to provide multiple rich content assets on a page (replacing static images).
However I understand what you are saying and if the Flash route fails we will drop the "sprinkled" approach and create a section of the site that displays all 3D models in one player where the user can flip between them. It's not the experience we wanted to provide our users with, but it's better than causing some of them browser crashes and hangs!
Your answer
Follow this Question
Related Questions
Stuttering web player 1 Answer
Does a large number of components will affect performance ? 2 Answers
Performance Differences in Standalone player versus Web Browser? 2 Answers
Web player performance problem on MAC OS X 3 Answers
Static Batching Performance issues on WebPlayer on Low end PC 0 Answers