web-performance-guide

Caching/Performance challenge

A guide to detect and fix performance issues in your web application, by Patricio Maseda, this document is based on insights gathered from years of experiencing and investigating issues in productive apps. I’ll highlight common issues and share the strategies and tools that have consistently helped me to level up application performance. We’ll assume an hypothetical client is experiencing degraded performance and sumarize what would be the key points to identify what’s happening and what actions could we take to fix/mitigate.

Hypothetical scenario:

A client has complained that their site is too slow. In particular, they have identified three particular pages where the page load is slow. Armed with this knowledge, you set out to try to understand what the issue is.

Proposed steps to debug and understand the problem:

  1. Communicate with the client: Use the regular communication channels to ask the most detailed explanation we can get about the observed issue.
  2. Navigate the production site (if productive, if not whatever env the client is seeing) trying to reproduce. After finding the issue happening live it’d be beneficial to try to reproduce it locally if possible.
  3. Now having a better understanding we should be able to scope and diagnose (making use of the browser’s network tab mainly) to know if the issue is mainly located in frontend or backend.

Hypothetical case 1: Issues are in the frontend side:

After taking a look to the affected pages the following issues have been observed:

#### Symptom: Images take too long to show up. The three pages shared by the client have something in common, they use a hero image component.


Symptom: Page remains blank or showing minimal content for a noticeable time, pages take time to be interactive. The 3 pages the client shared have something in common: they use a third party script to do translations in FE side.

Additionally check those changes do not affect the user experience in another way. For example, translation scripts are designed to load at the very beginning of the page load process, so they can parse the html and apply the translations to the DOM in the client. Deferring could cause the user to see a flash of untranslated texts that suddendly change to the desired language.


Symptom: Pages feel slow and unresponsive after executing certain action they have in common.


Hypothetical case 2: Issues are in the backend side, lets fix there:

Symptom: The whole page or a block of content is noticeable slow to load or after sending a form with data it takes long time to show some response to the user.

In the browser’s network tab we can see how some XHR requests with data needed to draw the page content are taking more than expected.


Hypothetical case 3: Issues that affect both frontend and backend:

Symptom: All page assets seem to be slow to load. The issue is more noticeable when accessing the page from far away locations.


Symptom: The app takes long to have some meaningful content in the screen (poor first contentful paint time)