many ad slots spiking cpu, multiplies render delays.

I have a website Im’ working on for a client which has 8 advertising slots which are JS. The code for each slot resides within a dedicated iframe inline throughout a page.

There are two issues I’m trying to resolve:

  1. The cpu spikes near 100% on webpagetest graphs.
  2. With 1 ad it generally takes 1 sec for the ad to show. With 8 ads it generally takes 8 or more secs for the 1st one to show.

Getting ads to show up as quickly as possible is the aim. I suspect they’re all trying to run at the same time hence the cpu spike & delay.

Thoughts?

You could run the tests on the “Dulles Thinkpad” location which uses dedicated machines that are fairly high-end though that’s just showing how much CPU would be consumed on high-end hardware.

If you test with Chrome and enable the “capture timeline” setting in the advanced settings you can get a dev tools timeline of the activity and see exactly what the slow parts of the js are that is causing the CPU to spike.

Quite possibly - there could also be resource contention in the fetching of the content for all 8 ads. Are all of them visible above the fold? If not then one quick fix would be to delay load the lower ads after the visible ones finish loading (onload handler on the frames should work well for detecting when each finishes loading).

I assume they don’t have much/any control over the content of the ads themselves :frowning:

50% is ‘Scripting’, 25% is not accounted for (not even listed as ‘Other’).

On the left of the waterfall thumbnail there is a link to download the actual timeline or to view it in the browser (may only work if you are using chrome). There you can see the actual function calls and durations.