Closed dlangenk closed 3 months ago
If you add
add_header Cross-Origin-Opener-Policy "same-origin
add_header Cross-Origin-Embedder-Policy "credentialless";
in /etc/nginx/conf.d/headers.include
on the webserver (might be the same as biigle/core/.docker/headers.include
) to activate Cross Origin Isolation (has to be tested for side effects).
we can reduce the throttling interval to e.g. 25ms here: https://github.com/biigle/magic-sam/blob/09ab1cb13edbb2e21175632365d480ac9861b4fc/src/resources/assets/js/ol/MagicSamInteraction.js#L138
Does the speed automatically increase if cross origin isolation is enabled or do you have to enable threading support (or choose a different WASM file) manually?
It seems like this should be supported by Chrome and Firefox although MDN lists credentialless
as experimental (ref1, ref2). Support for this could be optional, so if cross origin isolation is detected, threading is enabled and otherwise not. It needs careful testing, though, as the headers could have unexpected side effects. The headers should also be only set for the annotation tool view (by the PHP controller) to keep unintended side effects limited to where this is actually needed.
Oh sry my report could be misunderstood. If you activate Cross Origin Isolation then threading is automatically activated. (If it is not activated you can try the threading nevertheless with a Chrome flag that is what I meant). The WASM files we have are sufficient. We just need to set the Isolation flags.
You can enable multithreading without Cross Origin Isolation in Chrome by starting with commandline parameter --enable-features=SharedArrayBuffer for testing. Instead of PHP we could also use NGINX config for location /images/*/annotations. It should work, but I cannot get it to work with our setup.
location ~ ^/images/.+/annotations {
add_header Cross-Origin-Embedder-Policy require-corp;
add_header Cross-Origin-Opener-Policy same-origin;
}
I'm still in favor of adding the headers via PHP. The URL is an application route and these are defined in PHP as well. If the routes change, we don't want to update the Nginx config.
Seems reasonable.
Closing this in favor of https://github.com/biigle/magic-sam/issues/27 which will probably be much faster.
It seems that cross origin isolation is not activated and thus multithreading should not be able (See here) In the demo (see link above) this vastly increases the processing speed. In Biigle I don't see this increase when activating SharedArrayBuffer (can be activated with command line parameter in Chrome even without cross origin isolation).
Do we throttle the requests?Edit: I see we do. We could probably increase the responsiveness by enabling multihreading and decreasing throttling to 200ms.