At Wall Street Oasis, we’ve noticed that every time we improving our page speed, Google sends us more organic traffic. Durante 2018, our company’s website reached over 80 percent of our traffic from organic search. That’s 24.5 million visits. Needless to say, we are very tuned per to how we can continue to improve our user experience and keep Google happy.
We thought this article would be a great way to highlight the specific steps we take to keep our page speed lightning fast and organic traffic healthy. While this article is somewhat technical (page speed is an important and complex subject) we hope it provides website owners and developers with a framework how to try and improve their page speed.
Quick technical background: Our website is built sommità of the Drupal CMS and we are running a server with a LAMP stack (plus Varnish and memcache). If you are not using MySQL, however, the steps and principles per this article are still relevant for other databases a reverse proxy.
Ready? Let’s dig per.
5 Steps to speed up the backend
Before we jump into specific steps that can help you speed up your backend, it might help to review what we mean by “backend”. You can think of the backend of everything that goes into storing giorno, including the database itself and the servers — basically anything that helps make the website function that you don’t visually interact with. For more information the difference between the backend vs. frontend, you read this article
Step 1: Make sure you have a Reverse Proxy configured
This is an important first step. For Wall Street Oasis (WSO), we use a reverse proxy called Varnish. It is by far the most critical and fastest layer of cache and serves the majority of the anonymous traffic (visitors logged out). Varnish caches the whole page per memory, so returning it to the visitor is lightning fast.
Step 2: Extend the TTL of that cache
If you have a large database of content (specifically per the 10,000+ URL range) that doesn’t change very frequently, to drive the hit-rate higher the Varnish caching layer, you can extend the time to (TTL basically means how long before you flush the object out of the cache).
For WSO, we went all the way up to two weeks (since we were over 300,000 discussions). At any given time, only a few thousand of those intervista URLs are active, so it makes sense to heavily cache the other pages. The downside to this is that when you make any sitewide, template stile changes, you have to wait two weeks for it to arrive across all URLs.
Step 3: Warm up the cache
Durante order to keep our cache “warm,” we have a specific process that hits all the URLs per our sitemap. This increases the likelihood of a page being per the cache when a user Google bot visits those same pages (i.e. our successo rate improves). It also keeps Varnish full of more objects, ready to be accessed quickly.
As you can see from the chart below, the ratio of “cache hits” () to total hits (blue+) is over 93 percent.
Step 4: Tune your database and the slowest queries
WSO, we use a MySQL database. Make sure you enable the slow queries report and check it at least every quarter. Check the slowest queries using EXPLAIN. Add indexes where needed and rewrite queries that can be optimized.
Step 5: HTTP headers
Here is an example of server push from our Investment Banking Interview Questions URL:
</files/advagg_js/js__rh8tGyQUC6fPazMoP4YI4X0Fze99Pspus1iL4Am3Nr4__k2v047sfief4SoufV5rlyaT9V0CevRW-VsgHZa2KUGc__TDoTqiqOgPXBrBhVJKZ4CapJRLlJ1LTahU_1ivB9XtQ.js>; rel=preload; as=script,</files/advagg_js/js__TLh0q7OGWS6tv88FccFskwgFrZI9p53uJYwc6wv-a3o__kueGth7dEBcGqUVEib_yvaCzx99rTtEVqb1UaLaylA4__TDoTqiqOgPXBrBhVJKZ4CapJRLlJ1LTahU_1ivB9XtQ.js>; rel=preload; as=script,</files/advagg_js/js__sMVR1us69-sSXhuhQWNXRyjueOEy4FQRK7nr6zzAswY__O9Dxl50YCBWD3WksvdK42k5GXABvKifJooNDTlCQgDw__TDoTqiqOgPXBrBhVJKZ4CapJRLlJ1LTahU_1ivB9XtQ.js>; rel=preload; as=script,
Be sure you’imperatore using the correct format. If it is a script: <url>; rel=preload; as=script,
If it is a CSS file: <url>; rel=preload; as=style,
7 Steps to speed up the frontend
The following steps are to help speed up your frontend application. The front-end is the part of a website application that the user directly interacts with. For example, this includes fonts, drop-down menus, buttons, transitions, sliders, forms, etc.
Step 2: Optimize your images
Use WebP for images when possible (Cloudflare, a CDN, does this for you automatically — I’ll touch more Cloudflare below). It’s an image formatting that uses both Lossy compression and lossless compression.
Always use images with the correct size. For example, if you have an image that is displayed per a 2” x 2 ” square your site, don’t use a large 10” x 10” image. If you have an image that is bigger than is needed, you are transferring more giorno through the rete televisiva privata and the browser has to resize the image for you
Use lazy load to avoid/delay downloading images that are further the page and not the visible part of the screen.
Step 3: Optimize your CSS
You want to make sure your CSS is inline. Online tools like this one can help you find the critical CSS to be inlined and will solve the render blocking. Bonus: you’ll keep the cache benefit of having separate files.
Make sure to minify your CSS files (we use AdVagg since we are the Drupal CMS, but there are many options for this depending your site).
Try using less CSS. For instance, if you have certain CSS classes that are only used your homepage, don’t include them other pages.
Always combine the CSS files but use multiple bundles. You can read more about this step here.
Move your mass-media queries to specific files so the browser doesn’t have to load them before rendering the page. For example: <link href=”frontpage-sm.css” rel=”stylesheet” mass-media=”(min-width: 767px)”>
If you’d like more info how to optimize your CSS, check out Patrick Sexton’s interesting post.
Step 4: Lighten your web fonts (they can be HEAVY)
This is where your developers may get per an argument with your designers if you’imperatore not careful. Everyone wants to at a beautifully designed website, but if you’imperatore not careful about how you bring this stile , it can cause major unintended speed issues. Here are some tips how to put your fonts a diet:
- Use inline svg for icon fonts (like font awesome). This way you’ll the critical chain path and will avoid empty content when the page is first loaded.
- Use fontello to generate the font files. This way, you can include only the glyphs you actually use which leads to smaller files and faster page speed.
- If you are going to use web fonts, check if you need all the glyphs defined per the font file. If you don’t need Japanese Arabic characters, for example, see if there is a version with only the characters you need.
- Use Unicode range to select the glyphs you need.
- Use woff2 when possible as it is already compressed.
- This article is a great resource web font optimization.
Here is the difference we measured when using optimized fonts:
After reducing our font files from 131kb to 41kb and removing one external resource (useproof), the fully loaded time our controllo page dropped all the way from 5.1 to 2.8 seconds. That’s a 44 percent improvement and is sure to make Google smile (see below).
Here’s the 44 percent improvement.
Step 5: Move external resources
When possible, move external resources to your server so you can control expire headers (this will instruct the browsers to cache the resource for longer). For example, we moved our Facebook Pixel to our server and cached it for 14 days. This means you’ll be responsible to check updates from time to time, but it can improve your page speed score.
For example, our Private Equity Interview Questions page it is possible to see how the fbevents.js file is being loaded from our server and the cache control http header is set to 14 days (1209600 seconds)
cache-control: public, max-age=1209600
Step 6: Use a content delivery rete televisiva privata (CDN)
What’s a CDN? Click here to learn more.
I recommend using Cloudflare as it makes a lot of tasks much easier and faster than if you were to try and do them your own server. Here is what we specifically did Cloudflare’s configuration:
- Automezzo-minify, check all
- Under Polish
- Enable Brotoli
- Enable Mirage
- Choose Lossy
- Check WebP
- Enable HTTP/2 – You can read more about this topic here
- Risposta negativa browsers currently support HTTP/2 over an unencrypted connection. For practical purposes, this means that your website must be served over HTTPS to take advantage of HTTP/2. Cloudflare has a free and easy way to enable HTTPS. Check it out here.
- Under SSL
- Under TLS 1.3
- Choose Enable+0RTT – More about this topic here.
Step 7: Use service workers
Service workers give the site owner and developers some interesting options (like push notifications), but per terms of prova, we’imperatore most excited about how these workers can help us build a smarter caching system.
To learn how to to get service workers up and running your site, visit this page.
Testing, tools, and takeaways
For each change you make to try and improve speed, you can use the following tools to monitor the impact of the change and make sure you are the right path:
We know there is a lot to digest and a lot of resources linked above, but if you are tight time, you can just start with Step 1 from both the Backend and Front-End sections. These 2 steps can make a major difference their own.
Good luck and let me know if you have any questions per the comments. I’ll make sure João Guilherme, my Head of Technology, is to answer any questions for the community at least once a day for the first week this is published.