Jetpack: Photon and pingdom

Created on 12 Nov 2016  路  8Comments  路  Source: Automattic/jetpack

Hey

I am writing a tutorial on various cache plugins and testing them out at https://tools.pingdom.com
Even though I add a code snippet or a plugin to remove "Remove query strings from static resources" to improve the overall score I notice that this remains:

Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources:

http://api.searchiq.xyz/js/container/siq-contai ... 80150&engineKey=652a5210f12fed32f2c6e72f2f77da6a
http://easywebdesigntutorials.com/wp-includes/c ... ons.min.css?ver=6df00f04f2c4a9bae93df1b531542212
http://easywebdesigntutorials.com/wp-includes/j ... ease.min.js?ver=6df00f04f2c4a9bae93df1b531542212
http://i0.wp.com/easywebdesigntutorials.com/wp-content/uploads/404-plugin-image.jpg?resize=200%2C150
http://i0.wp.com/easywebdesigntutorials.com/wp- ... ing-Soon-Page-Elite-example.jpg?resize=275%2C150
http://i0.wp.com/easywebdesigntutorials.com/wp- ... t-box-Genesis-Code-Snippets.jpg?resize=300%2C143
http://i0.wp.com/easywebdesigntutorials.com/wp- ... erpts-tinymce-visual-editor.jpg?resize=215%2C150
http://i0.wp.com/easywebdesigntutorials.com/wp- ... ixed-footer-TwentySeventeen.jpg?resize=300%2C148
http://i0.wp.com/easywebdesigntutorials.com/wp- ... lytics-Dashboard-For-WP-ogo.jpg?resize=217%2C150
http://i0.wp.com/easywebdesigntutorials.com/wp- ... ploads/JavaScript-Resources.jpg?resize=243%2C150
http://i0.wp.com/easywebdesigntutorials.com/wp- ... xonomies-Attachment-details.png?resize=167%2C150
http://i0.wp.com/easywebdesigntutorials.com/wp-content/uploads/Ninja-Forms-3.jpg?resize=236%2C150
http://i0.wp.com/easywebdesigntutorials.com/wp- ... /Ninja-Forms-Form-Templates.jpg?resize=236%2C150
http://i0.wp.com/easywebdesigntutorials.com/wp- ... ground-cPanel-Addon-domains.jpg?resize=161%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... de-Pro-top-orange-gradient1.jpg?resize=300%2C125
http://i1.wp.com/easywebdesigntutorials.com/wp- ... hanging-non-utf8-characters.jpg?resize=217%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... Contact-Form-7-Plugin-image.png?resize=287%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... e-WordPress-sidebar-options.jpg?resize=154%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... ads/Duplicator-plugin-image.png?resize=300%2C146
http://i1.wp.com/easywebdesigntutorials.com/wp- ... mage-behind-title-WordPress.jpg?resize=239%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... ploads/On-scroll-sticky-nav.jpg?resize=300%2C121
http://i1.wp.com/easywebdesigntutorials.com/wp- ... -Footer-Genesis-Child-Theme.jpg?resize=248%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... ed-Ninja-Forms-Contact-Form.jpg?resize=144%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... log-post-previews-WordPress.jpg?resize=225%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... f-page-post-using-wp-editor.jpg?resize=211%2C150
http://i1.wp.com/easywebdesigntutorials.com/wp- ... -single-post-page-wordpress.jpg?resize=232%2C150
http://i2.wp.com/easywebdesigntutorials.com/wp- ... oads/Bluehost-control-panel.jpg?resize=247%2C150
http://i2.wp.com/easywebdesigntutorials.com/wp- ... ial-media-tooltip-wordpress.jpg?resize=241%2C150
http://i2.wp.com/easywebdesigntutorials.com/wp- ... eview-Genesis-Code-Snippets.jpg?resize=300%2C141
http://i2.wp.com/easywebdesigntutorials.com/wp- ... esis-Themes-widget-sections.jpg?resize=149%2C150
http://i2.wp.com/easywebdesigntutorials.com/wp- ... ytics-Dashboard-plugin-logo.jpg?resize=199%2C150
http://i2.wp.com/easywebdesigntutorials.com/wp- ... lytics-by-Yoast-plugin-logo.jpg?resize=218%2C150
http://i2.wp.com/easywebdesigntutorials.com/wp-content/uploads/Ninja-Forms-logo.jpg?fit=234%2C147
http://i2.wp.com/easywebdesigntutorials.com/wp- ... ts-For-WordPress-top-banner.jpg?resize=300%2C140
http://i2.wp.com/easywebdesigntutorials.com/wp- ... image-as-featured-WordPress.jpg?resize=203%2C150
http://i2.wp.com/easywebdesigntutorials.com/wp- ... arallax-scrolling-animation.jpg?resize=300%2C144
http://netdna.bootstrapcdn.com/font-awesome/4.2 ... awesome.css?ver=6df00f04f2c4a9bae93df1b531542212
http://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201645

How do I take care of this speed bump? It seems the most logical is not to use Photon, but I am guessing there is another way that is even better.

Photon

Most helpful comment

Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources

Short version: this is old information that doesn't really apply any more

Long version.

Nearly ten years ago Steve Souders was talking about site performance, he even wrote a few books about it ( he is amazing, I recommend everything he writes ). One of the things he noticed is that Squid ( a popular caching server ) had a default configuration that told it not to cache any URLs with a querystring ( the ? in the URL ). To avoid that issue a performance "rule" came about that said don't use "?" in any static resources that you want to get cached - https://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

Fast forward to mid-2008 and Squid version 2.7, where they changed the default config so that GET requests with a "?" in them were cached ( assuming cache headers didn't tell them other wise ). This is noted in the Squid Wiki - http://wiki.squid-cache.org/ConfigExamples/DynamicContent

Perhaps it took some time for the majority of Squid installs to update, lets call it 4 years. That would still make this recommendation obsolete, measured in years. However, many "speed test" tools have stuck to this recommendation. I think it reflects poorly on the tools that still include this.

In the case of Pingdom, they link to the Page Speed Insight rules - https://developers.google.com/speed/docs/insights/rules - which doesn't mention anything about trying to avoid "?" in GETs for caching. The recommendation is to rely on on caching headers.

To my knowledge there are no widely deployed caching servers that will not cache a GET request just because it has a "?". If anyone has data that proves otherwise I'd be very interested in seeing it.

All 8 comments

You can safely ignore that notice for Photon. Photon already caches those images, before they're queried on your site. The query strings in the Photon URLs aren't the typical query strings Pingdom expects when scanning sites. They are not there for caching, or to resize the images on the fly in your browser; they in fact refer to different cached images on Photon servers.

Deactivating Photon would actually remove the optimisation and caching work we do with your images.

It would be great if someone could check the various speedtest sites tools.pingdom.com, gtmetrix.com etc and find where there are discrepancies between what is reported for various JetPack scripts etc and contact the sites and let them know about it.

cc @josephscott, who does a lot of work with this.

Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources

Short version: this is old information that doesn't really apply any more

Long version.

Nearly ten years ago Steve Souders was talking about site performance, he even wrote a few books about it ( he is amazing, I recommend everything he writes ). One of the things he noticed is that Squid ( a popular caching server ) had a default configuration that told it not to cache any URLs with a querystring ( the ? in the URL ). To avoid that issue a performance "rule" came about that said don't use "?" in any static resources that you want to get cached - https://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

Fast forward to mid-2008 and Squid version 2.7, where they changed the default config so that GET requests with a "?" in them were cached ( assuming cache headers didn't tell them other wise ). This is noted in the Squid Wiki - http://wiki.squid-cache.org/ConfigExamples/DynamicContent

Perhaps it took some time for the majority of Squid installs to update, lets call it 4 years. That would still make this recommendation obsolete, measured in years. However, many "speed test" tools have stuck to this recommendation. I think it reflects poorly on the tools that still include this.

In the case of Pingdom, they link to the Page Speed Insight rules - https://developers.google.com/speed/docs/insights/rules - which doesn't mention anything about trying to avoid "?" in GETs for caching. The recommendation is to rely on on caching headers.

To my knowledge there are no widely deployed caching servers that will not cache a GET request just because it has a "?". If anyone has data that proves otherwise I'd be very interested in seeing it.

So CloudFlare has cache settings that are set based on ?, however I can't think of a case where Photon urls would load thru CloudFlare.

screenshot may 31 08 29 43

With that said, its tough to explain to clients that these tools are incorrect, so just having a filter for developers to disable ssl=1 will allow us to improve the grades on these sites and move on with our day.

Has anyone reached out to @gtmetrix or @pingdom for comments?

CloudFlare has cache settings that are set based on ?

Query strings still exist and are used in multiple situations, so that setting is relevant. Every WP site's shortlinks uses query strings, for example:
http://brandonhubbard.com/?p=44

its tough to explain to clients that these tools are incorrect, so just having a filter for developers to disable ssl=1 will allow us to improve the grades on these sites and move on with our day.

It won't improve your grades much though, as Photon uses other parameters (like resize, w, h, crop, and more). The tools will keep returning notices, even if you remove one of the parameters (like ssl).

Instead, I would recommend explaining the situation to your clients, using the information above:
https://github.com/Automattic/jetpack/issues/5618#issuecomment-264022916

Such an explanation can also be an opportunity to explain how to interpret results from such tools in general.

I agree query strings exist, and I understand they will not go away, nor would I suggest they should. I also know how photon works, and understand that all the parameters are valid. The only one that I think could/should be removed would be ssl=1. Mainly because if the url is being loaded with https it should be obvious it is using SSL/TLS.

Communicating to clients will always be ideal, but some just won't understand, or choose to listen. Some will run the test and never contact their dev to question the issues, etc. How many people run these tests after activating Jetpack with Photon and see that grade drop, and think Jetpack is a problem? I know that the benefits on these test would be small for most sites. I took a random 5 of our sites, and tested:

Site - # of resources that would be fixed out of the # of resources reported with the ?

imforza.com - 9 images out of 28
wilseyrealty.com - 4 out of 21
collegestationhomes.com - 0 out of 10
hiltonhyland.com - 3 out of 26
davidfetveit.com - 1 out of 21

You are correct, for most sites the benefits are small, and I only counted images with ssl=1 as being fixed, if they had any other parameters I couldn't count is as being fixable.

While benefits are small for most sites, there may be some sites where it this change might have a bigger impact. Fixing any of the reported issues on these test, no matter how small, seem beneficial.

Here is a reply from Pingdom support:
(I asked them a long time ago and was told that it was forwarded to the developers, but I never heard back from them, so I recently asked again about this issue.)


Hi there,

Thank you for contacting us

I'm afraid we don't have much of an update for you as it's still on our developers table, but they did determine that the change needed would have to be included in a major update to the tool, which will eventually come but we don't have any ETA for it at the time being. It is still with the team however.
Kind Regards
Amanda Borg | Pingdom Support

Was this page helpful?
0 / 5 - 0 ratings