Whatsapptistics: don’t forget the favicon

I wrote about a Whatsapptistics, a project written in Golang, which relies heavily on AWS. The project creator generously offered to walk me through the code and explain why he chose the tools he used, as well as give me a brief overview on how those tools tie into the code. Maybe I’ll write a more detailed, tutorial-style blog post about the file structure, tools, and code when it happens, but in the meantime I’ve picked up a couple small random issues I came across just to help out.

While on the Whatsapptistics website, I noticed a 404 error in the console for a missing favicon resource. Many browsers by default look for a favicon.ico file when no favicon is assigned, and so if you’re missing one the server will return a 404 (file does not exist) status error with every site visit.

You can read this interesting post I came across about why it’s important to avoid having 404 errors on your site. Apparently a missing favicon caused Instagram to crash back in the early days. Because the server must hit the hard disk to find a file, failed calls waste bandwidth and strain the server. Normally, a server will cache a file in memory after the first time it’s found, so that the next time there is a request for it, it can find and pull the file from memory. Every time a page is requested on a site with a missing favicon, the server is forced to access the disk (because there is nothing cached), and if there are many requests being made, like when people were first signing up to Instagram, the server can get overloaded and crash.

You can easily solve this problem by either linking a blank favicon.ico file or an actual favicon in the <head> :

<link rel='icon' type='image/x-icon' href='favicon.ico'/> 
//or other image type
<link rel='icon' type='img/png' href='icon.png'>

Adding a favicon and ensuring calls to your server do not result in 404 errors gives you the ability to handle many page requests without potentially overloading your server. Should you need to scale, you will now have one less thing to worry about.