-
Notifications
You must be signed in to change notification settings - Fork 11
remove info request #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
QA +1 the test app produces the following output in the console: I also pulled this change into our internal wdesk_sdk test app and verified that we could establish a websocket connection with our frontend. |
| self.emit('finish', info, rtt); | ||
| }); | ||
| InfoReceiver.prototype.doXhr = function(_baseUrl, _urlInfo) { | ||
| this.emit('finish', {}, window.navigator.connection?.rtt || 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial
/infoXHR tends to add ~200 ms
Out of curiosity, how did 100 get picked as the default (vs 200 mentioned in the description)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The p75 of window.navigator.connection?.rtt for prod users is 100 ms.
And the 200 ms was the p75 of the /info request for prod users prior to some other optimizations that have since caused the value to increase to ~350 ms. That increase is most likely due to client side resource contention because the optimizations tend to be things that further saturate the CPU by allowing execution of more async tasks. So the browser context switches to a bunch of stuff then finally comes back to resolving the request at a later time than it would have had there not been as much other stuff to do.
Also worth noting that connection is null for firefox but will contain a value for chrome/edge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the || 100 makes sense. Out of curiosity, would (rtt || 100) * 2 or 4 more closely match the current semantics?
(I haven't looked at how this value is actually used, so I'm just learning. Feel free to ignore me :-).)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rtt value is used to create the transport timeout in the countRTO() method: https://github.com/Workiva/sockjs_client_wrapper/blob/master/lib/sockjs.js#L976-L987
This is what triggers the SockJS fallback – if the websocket connect request takes longer than the RTO value, then it will simply try the next transport option(s).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this rtt value is currently used is:
For our users, even the p50 of /info is just over 100. So most of the time, the connect timeout is set to something a bit over 100 * 4 * 2 = 800. So by defaulting to 100, firefox users will see a reduction to their timeout of about 40 ms most of the time. For chrome/edge users I wouldn't think there'd be much difference because I would assume the browser's estimated rtt will tend to match the rtt of the /info request.
TBH, it's probably advisable to set a hardcoded timeout using the options passed to the constructor of SockJS. But even that can be overridden at runtime by (2) because it actually does timeout = max(options.timeout, ~800).
|
Do we also need to make the change in |
Right now, our app points to sockjs.js, not sockjs_prod.js. But it still seems appropriate to regenerate the minified version. I added an npm script to minify the js and generate a new source map. I deleted the old source map for the unminified code since the unminified code is now the source of truth. |
evanweible-wf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, but since we're making an edit to sockjs.js (which was previously just vendored from sockjs-client) and treating it as our source file now, could we add a comment either at the top of this file or in the readme to that effect? I noticed we removed the sockjs.js.map file (makes sense given this change), but we should also remove the //# sourceMappingURL=sockjs.js.map at the bottom of this file.
|
QA +1 successfully established a websocket connection on chrome, firefox, and safari |
|
@Workiva/release-management-p |
rmconsole-wf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from RM
Motivation
The initial
/infoXHR tends to add ~200 ms to websocket connections in released/deployed environments due to public internet round trip latency.Changes
Removed the
/inforequest replacing its response with sane defaults.Release Notes
Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review:
QA Checklist
Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: