Skip to content
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

Merged

Conversation

snapwich
Copy link
Collaborator

@snapwich snapwich commented Jun 19, 2018

Type of change

  • Bugfix
  • Feature

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 with config.setConfig({maxRequestsPerOrigin: 6})). Setting the maxRequestsPerOrigin to 1 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)
comparison1
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)
comparison2

Comparison of results on slow connection in 1-x before and after max concurrency per origin implemented.
comparison3
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 as IE9 is no longer supported by Prebid.js.

@@ -74,6 +74,11 @@ events.on(CONSTANTS.EVENTS.BID_ADJUSTMENT, function (bid) {
adjustBids(bid);
});

const MAX_REQUESTS_PER_ORIGIN = 4;
Copy link
Member

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?

Copy link
Collaborator Author

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) {
Copy link
Collaborator

@jaiminpanchal27 jaiminpanchal27 Jun 20, 2018

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 ?

Copy link
Collaborator Author

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.

@jaiminpanchal27 jaiminpanchal27 merged commit 050494e into prebid:master Jun 20, 2018
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* 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
florevallatmrf pushed a commit to Marfeel/Prebid.js that referenced this pull request Sep 6, 2018
* 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
StefanWallin pushed a commit to mittmedia/Prebid.js that referenced this pull request Sep 28, 2018
* 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
ghost pushed a commit to devunrulymedia/Prebid.js that referenced this pull request Jan 30, 2019
* 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
AlessandroDG pushed a commit to simplaex/Prebid.js that referenced this pull request Mar 26, 2019
* 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
AlessandroDG pushed a commit to simplaex/Prebid.js that referenced this pull request Mar 26, 2019
* 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
@robertrmartinez robertrmartinez deleted the max-origin-concurrent-auctions branch July 5, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants