Your Page Is Slow and You Have Never Opened the Network Tab
A customer says the orders page takes ages to load. You open it on your machine and it feels fine. You add some logging to the backend, the queries look quick, and you are stuck. Somebody asks whether you checked the net
A customer says the orders page takes ages to load. You open it on your machine and it feels fine. You add some logging to the backend, the queries look quick, and you are stuck. Somebody asks whether you checked the network tab. You nod, and then quietly look up what they mean.
Every major browser has developer tools built in, and the network panel is one of the most useful parts of them. In Chrome, Edge and Firefox you can open the tools with F12, or with Ctrl Shift I, or Cmd Option I on a Mac, and choose Network. Then reload the page. Every request the page makes appears as a row, with its status, its size, and how long it took.
Start with the waterfall, the column of bars on the right. Each bar is one request, placed on a timeline. You are looking for shape, not detail. A long single bar means one slow request. A staircase of bars, each starting when the previous one finishes, means requests waiting on each other when they could run together. Dozens of short bars means the page is making far more calls than you thought.
Click on a slow request and open its Timing tab. It breaks the time into stages. If most of it is spent waiting for the server to respond, the problem is on the backend, and you now know exactly which endpoint to investigate. If most of it is spent downloading, look at the size column. A response of several megabytes for a list of twenty orders tells you something is sending far more data than the page uses.
Then make your machine behave more like your customer's. Tick Disable cache, so you see what a first visit costs. Use the throttling menu to simulate a slower connection. Pages that feel instant on office broadband can take many seconds on a weak mobile signal, which is often exactly what the customer meant.
Finally, sort the list by size and by time, and write down the three worst requests. That short list is a much better starting point than guessing. Spend ten minutes on this panel before your next performance bug, and you will rarely be stuck in the same way again.
– Asael Shinder
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.