-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Max origin concurrent auctions #2743
Max origin concurrent auctions #2743
Conversation
@@ -74,6 +74,11 @@ events.on(CONSTANTS.EVENTS.BID_ADJUSTMENT, function (bid) { | |||
adjustBids(bid); | |||
}); | |||
|
|||
const MAX_REQUESTS_PER_ORIGIN = 4; |
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.
what's the magic behind 4? I thought modern browser was 6?
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.
On my specific test page there wasn't much difference with fast internet between 4 and 6 but there was a slight improvement on slow pages with 4 vs 6. I'm not sure why, but I decided it would be safer to go with that value; if other's test prove differently then we could change it down the line. It's also one of the reasons I made it configurable.
sourceInfo[source].SRA = false; | ||
} | ||
}, | ||
done(origin) { |
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.
Should we rename this done to avoid confusion between auction done and this done ?
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.
we could, although I'm not sure it's a huge deal. I intentionally kept it as short as possible since it's an object property, so it won't be minified.
* initial attempt at limiting concurrenet auctions by origin * fix queueing of auctions for max origin * don't decrement on timeout as it is already called by onreadystatechange * move auction timer so it doesn't start until queued auction starts * set default max concurrent origin requests to 4 and make configurable * fix tests to not queue for auction.callBids * change MAX_REQUEST_PER_ORIGIN to local var
* initial attempt at limiting concurrenet auctions by origin * fix queueing of auctions for max origin * don't decrement on timeout as it is already called by onreadystatechange * move auction timer so it doesn't start until queued auction starts * set default max concurrent origin requests to 4 and make configurable * fix tests to not queue for auction.callBids * change MAX_REQUEST_PER_ORIGIN to local var
* initial attempt at limiting concurrenet auctions by origin * fix queueing of auctions for max origin * don't decrement on timeout as it is already called by onreadystatechange * move auction timer so it doesn't start until queued auction starts * set default max concurrent origin requests to 4 and make configurable * fix tests to not queue for auction.callBids * change MAX_REQUEST_PER_ORIGIN to local var
* initial attempt at limiting concurrenet auctions by origin * fix queueing of auctions for max origin * don't decrement on timeout as it is already called by onreadystatechange * move auction timer so it doesn't start until queued auction starts * set default max concurrent origin requests to 4 and make configurable * fix tests to not queue for auction.callBids * change MAX_REQUEST_PER_ORIGIN to local var
* initial attempt at limiting concurrenet auctions by origin * fix queueing of auctions for max origin * don't decrement on timeout as it is already called by onreadystatechange * move auction timer so it doesn't start until queued auction starts * set default max concurrent origin requests to 4 and make configurable * fix tests to not queue for auction.callBids * change MAX_REQUEST_PER_ORIGIN to local var
* initial attempt at limiting concurrenet auctions by origin * fix queueing of auctions for max origin * don't decrement on timeout as it is already called by onreadystatechange * move auction timer so it doesn't start until queued auction starts * set default max concurrent origin requests to 4 and make configurable * fix tests to not queue for auction.callBids * change MAX_REQUEST_PER_ORIGIN to local var
Type of change
Description of change
In testing I was seeing poorer performance with 1-x (compared to 0.34) when concurrent auctions (simultaneous
pbjs.requestBids()
) were running on slow connection. 1-x is concurrent by default, and 0.34 is never concurrent.A lot of concurrency issues seemed to be related to max requests per origin limits in browsers. This pull-request adds a queuing feature for auctions that will queue auctions that would put the client over the limit of requests per origin (with that limit defaulting to
4
and being configurable withconfig.setConfig({maxRequestsPerOrigin: 6})
). Setting themaxRequestsPerOrigin
to1
will effectively emulate the behavior in 0.34 by having all concurrent auctions be queued until the previous auction has finished.Comparison of results before and after this pull-request change on 1-x for a fast connection. (stacked requests from first example go off bottom of screen whereas second example shows all requests)
Speeds are very similar between each other and both results are very fast compared to 0.34 (1-x total time for requests in both examples above about ~1s, but ~3.5 seconds for 0.34 below due to no concurrency)
Comparison of results on slow connection in 1-x before and after max concurrency per origin implemented.
Total time of all auctions on left is 3.5s, but without max concurrency per origin timed-out bids cause further auctions to miss their boat. Much improved on the right with limited requests per origin, total time of 7s for all auctions (as some are queued) but get back 3 times as many bids.
Other information
Related to #2648.
Also cleaned up the ajax module to remove
XDomainRequest
support asIE9
is no longer supported by Prebid.js.