-
Notifications
You must be signed in to change notification settings - Fork 29
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
Home page loads in ~11MB of images, ~13MB of JS #6254
Comments
One of the reasons that the new page is slow, is that
This also means that the page scroll position is lost when navigating backwards and forwards, since the scroll position refers to the height of the server-rendered Here's the new home page in Firefox, with JS disabled. This is what a user will see if they're on a flaky connection and one of the JS files errors while it's downloading. |
Paul Irish's EDIT: There's a |
@eatyourgreens I went ahead and resized the penguin photo. I didn't bother to optimize the other 2 as they soon will be pushed off the feed by new posts. This is a good reminder to optimize our image sizes before uploading to the blogs. |
@seanmiller26 👍 The penguin image looked like it had been uploaded straight from someone's iPhone. I'm surprised that Wordpress doesn't automatically resize images for the blog RSS feeds. Longer term, it should be straightforward to add rules to https://github.com/zooniverse/thumbnailer/ that allow it to resize images from |
If you want to test this in a browser, I recommend setting throttling to either 4G or 'slow 4G', which is apparently representative of rural network speeds in the USA. For a more in-depth write-up of JS-first performance and its disproportionate effect on the least privileged members of society, read Alex Russell's excellent Reckoning series of posts. Simon Willison summarised it in a single page too. |
@seanmiller26 I've added lazy loading in #6255, so that blog images aren't loaded unless you scroll down to that section of the page. |
Now that #6255 has merged, Core Web Vitals for the home page are looking a lot better. Total blocking time: 0.13s, speed index 2.6s on desktop. Mobile is still pretty slow. Total JS jize is ~1.5MB. Page Speed Insights also reports that static images served from |
@eatyourgreens the homepage is no longer loading the weight described in the Issue title, but before I close it I want to follow-up with your point about:
Correct, custom headers have not been set in img files such as https://static.zooniverse.org/fem-assets/green-pea.jpg. When I visit https://www.zooniverse.org/about, "refetched" means fetched from the CDN. Are you suggesting adding custom headers via Next.js config to single out image files in static.zooniverse.org so the browser can cache them? We're actively working on an overall cache busting strategy for the Zooniverse website especially now that Next.js is being used to build static pages like /about, and not just dynamic pages like /projects/etc. Cache busting AFD on deploy of a new app build will happen, but that's only for www. Adding custom headers to image files in static.zooniverse.org will require additional work to handle any changes made to files at static.zooniverse.org. |
I imagine headers for those files would have to be set either by nginx or Front Door. static.zooniverse.org isn't handled by Next.js. Here's the explanatory link from the Lighthouse report. https://developer.chrome.com/docs/lighthouse/performance/uses-long-cache-ttl/ |
Removing the |
@goplayoutside3 by the way, https://www.zooniverse.org is still sending an invalid Looking at the PR that fixed that bug (vercel/next.js#61330), you might need to add https://dev.to/omaiboroda/stale-while-revalidate-and-its-usage-with-nextjs-55c7 |
Files in http://static.zooniverse.org/fem-assets now have cache control |
Sounds cool. 👍 Google also complained about static files from |
By the way, I think the original issue here, which was the large YouTube JS and the large blog images, has been fixed. So feel free to close this and open issues for other performance recommendations from the Google page speed report. |
Agreed. I'm starting to see expected cache headers on images fetched from the /fem-assets folder in blob storage. I'll ask Zach how he feels about cache headers on panoptes-uploads too. There are still a couple of your comments that have not been addressed, but are scoped to #6344. |
Expected behavior
Images should be optimised for display online, and the home page should ideally load in less than 1s.
Current behavior
The home page pulls in a bunch of unoptimised images from the Zooniverse blogs, ranging in size from 0.5MB all the way up to a whopping 7.5MB! Even on fibre broadband, the page takes 11s to fully load.
These images in particular could benefit from being resized for display online:
Steps to replicate
Examine the overall page weight and image sizes in the Network panel of the browser dev console.
Signed-out, the home page also loads in more than 10MB of YouTube JS, for a total page weight of 31MB.
Additional context
Here's a page speed report, including Core Web Vitals:
https://pagespeed.web.dev/analysis/https-fe-root-preview-zooniverse-org/xk3wjubq40?form_factor=mobile
It's a failure on both desktop and mobile, but includes a list of steps you can take in order to pass. It estimates that you can reduce image sizes by at least 6MB.
The new page renders entirely in the browser and is also much slower than the old home page:
The text was updated successfully, but these errors were encountered: