Automating performance audit using Google Lighthouse with Azure
Running performance audits on a public-facing website is essential, in the past the audits was conducted manually. Recently, I have been asked to propose a solution for generating the Google Lighthouse report automatically.
What is lighthouse?
Lighthouse is an open-source tool that analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices. you can find the repo here.
It mentioned in its document that you can run the report automatically with Node CLI. Great start! Yet, I can run it on my machine, but how I share the reports with other people i.e. business as well as integrating with powerBI for reporting purpose?
After googling around, I didn’t find anything useful. so I decided to come up with my own solution.
Boom! here is the proposed solution.
Building the report on azure build agent, and publishing the report into blob storage. Simple right?! With this approach, there is no dedicated node server required. In addition, storing report in blob can be simply shared with stakeholders and integrated with PowerBI.
Brilliant, the completed architectural diagram as shown below. it’s a small implementation, but it still follows Well-Architected framework.
To trigger generating the reports via Azure devOps allows me to setup a scheduled pipeline. it provides insight about when pipeline is being triggered and sent notification if it fails. with code as infrastructure mindset, all code are managed in Azure git and deployed via CI/CD pipeline.
Integrating with Azure AD for authentication, and using RBAC for segregating duties within the team for performing the jobs i.e. update pipeline, setup scheduling.
Microsoft guarantee at least 99.9% availability for Azure devOps service and using self-hosted agent as failover plan for high availability.
A single blob supports up to 500 requests per second. Since there will not have massively requests for my project, so I’m not worry about the performance at all. Yet, if you want to tuning the performance for your project, you can always use CDN (content delivery network) to distribute operations on the blob. or you can even use block storage account, which provides a higher request rate, or IOPS.
Comparing with VM solution, I believe this solution deliver at scale with the lowest price. Storage only costs AUD $0.31 per GB.
Hopefully you like this solution or share your thoughts if you have better options. All comments/suggests are welcomed.