ghost-fvtt / fxmaster

A module for Foundry Virtual Tabletop that adds various special effects.
Other
18 stars 13 forks source link

FxMaster overloading chrome with requests #209

Closed KevinTheKittyCat closed 2 years ago

KevinTheKittyCat commented 2 years ago

Expected Behavior

When using the animations, they should play "instantaneously", and should show up for both the GM and Player as such.

Current Behavior

When using JB2A, the animations should play "instantaneously", but at the moment they take too long to load before any animation is played, see https://gyazo.com/1942fa004dd99b21eb0566c57a452c47 .

We believe it is due to the number of effects it is trying to load in beforehand. We are using jb2a to test, as it has a lot of effects. What we encountered is flooded requests, and chrome will freeze up the domain, see: image even from the cache, it will take around 3-5 seconds before they load properly.

While this is happening, you are not allowed to reload the site and have issues till it is all closed down properly. We would suggest lazy loading the animations.

Steps to Reproduce

  1. Have a lot of effects / Use JB2A's premium module
  2. Open the effects manager
  3. Try to play non-cached effects.

Context

No response

Version

v2.2.4

Foundry VTT Version

v9.249

Operating System

Windows

Browser / App

Chrome

Game System

dnd5e (1.5.7)

Relevant Modules

JB2A - Patreon Complete Collection (0.3.6)

ghost91- commented 2 years ago

I agree that the situation is less than ideal. Most likely, it’s due to the effects all being loaded to be displayed in the effect manager.

I will take a look if there is an easy way to improve this. That said, I won’t invest too much time as I consider the special effects related part of FXMaster to be legacy. The sequencer module fills that niche quite a bit better by now. I am even considering removing that functionality from FXMaster altogether in the future. No concrete plans yet, as it’s still used by quite a few people, but it will probably happen at some point.

so unless I find an easy solution for this, my suggestion would be to just try if you can also achieve what you want with sequencer instead of FXMaster. The experience there might be quite a bit better.

ghost91- commented 2 years ago

The situation might also be improved if you can use HTTP/2 for serving the assets, instead of HTTP/1.1, as HTTP/2 allows for a lot more requests in parallel.

kakaroto commented 2 years ago

The situation might also be improved if you can use HTTP/2 for serving the assets, instead of HTTP/1.1, as HTTP/2 allows for a lot more requests in parallel.

Even with http2, the issue is still there, we've encountered this on the Forge, trying to debug why a user was having minute long requests to assets, but the issue is that http2 can only do 100 concurrent requests at a time, and when it's overloaded like this with 500+ requests, it seems to freeze up chrome because it has trouble handling the queue. It will start to download at an incredibly slow speed everything, with everything else being stuck on 'pending' state, and as Kevin said, even loading from disk cache would take 2 to 3 seconds per request (it's generally 2ms when there isn't 500+ queued requests). Eventually, it can cause the request handler in chrome to lock up for the entire domain (happened to me a couple of times while debugging this).

A lazy load would be great, but if this is legacy, then I'd recommend a simple fix like this instead :

// Don't load the preview of effects if there are too many as it can cause issues with the browser queuing too many requests at once
if (effects.length > 100) return; 

EDIT: Oh, I see you added the lazy load yesterday! Cool, thanks :)

ghost91- commented 2 years ago

Yeah, I hope this improves things. I will push a release out pretty soon. I'm just finishing up improving the readme first.