Documentation / Performance Dashboard
Monitor the performance of your web site using the performance dashboard.
- What you need
- Up and running in (almost) 5 minutes
- Example dashboards
- Configure running your tests
- Configure Graphite
- Using S3 for HTML and video
- Production Guidelines
What you need
Up and running in (almost) 5 minutes
- Download our Docker compose file:
curl -O https://raw.githubusercontent.com/sitespeedio/sitespeed.io/main/docker/docker-compose.yml
docker-compose up -d(make sure you run the latest Docker compose version)
- Run sitespeed to get some metrics:
docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:26.1.0 --graphite.host=host.docker.internal https://www.sitespeed.io/ --slug yourTestName --graphite.addSlugToKey true(running on Linux? Check how to access localhost).
- Access the dashboard: http://127.0.0.1:3000
- When you are done you can shut down and remove all the Docker containers by running
docker-compose stop && docker-compose rm. Container data will be kept.
- To start from scratch, also remove the Graphite and Grafana data volumes by running
docker volume rm performancedashboard_graphite performancedashboard_grafana.
If you want to play with the dashboards, the default login is sitespeedio and password is …well check out the docker-compose.yml file.
When you run this in production make sure to checkout our production guidelines.
Docker compose file #
We have prepared a Docker Compose file that downloads and sets up Graphite/Grafana and sitespeed.io with a couple of example dashboards. It works perfectly when you want to try it out on localhost, but if you want to run it in production, you should modify it by making sure that the metrics are stored outside of your container/volumes. If you prefer InfluxDB over Graphite, you can use that too, but right now we only have one ready-made dashboard for InfluxDB (thank you Olivier Jan for contributing to that dashboard!).
Pre-made example dashboards #
We insert ready-made dashboards with a Docker container using curl, making it easy for you to get started. You can check out the container with the dashboards here: https://github.com/sitespeedio/grafana-bootstrap-docker
The example dashboards are generic dashboards that will work with all data/metrics you collect using sitespeed.io. We worked hard to make them and the great thing is that you can use them as base dashboards to create additional dashboards if you like.
The dashboards have a couple of templates/variables (the dropdowns at the top of the page) that make the dashboards interactive and dynamic. A dashboard that shows metrics for a specific page has the following templates:
The path is the first path after the namespace. Using the default values, the namespace looks like this: sitespeed_io.default.
The testname is the the slug that you give to your test. Make sure to run your test with
--slug yourTestName --graphite.addSlugToKey true so that the slug is added to Graphite and the default dashboards work.
If you choose one of the values in a template, the rest will be populated. You can choose from checking metrics for a specific page, browser, and connectivity.
The default namespace is sitespeed_io.default and the example dashboards are built upon a constant template variable called $base that is the first part of the namespace (that default is sitespeed_io but feel free to change that, and then change the constant).
Page metrics #
There are two pages that show individual metrics for a page (one for desktop and one for mobile). You should use these as example dashboards to inspire you what you can do. We try to squeeze in all data in these dashboards and you can view those by expanding each row.
The dashboards looks something like this:
And scroll down to see more, do not forget to click on the rows to expand and see all metrics.
User Journeys example dashboards #
We have a couple of example dashboards on how to add your own user journeys dashboards. When you import those dashboards into Grafana you need to add the Grafana variables that match your tests.
This is an example dashboard login into Wikipedia. That user journey measure four pages.
We also have examples that take three pages.
The leaderboard #
Chrome User Experience Report #
Whatever you want #
Do you need anything else? Since we store all the data in Graphite and use Grafana you can create your own dashboards, which is super simple!
If you are new to Grafana you should checkout the basic concepts as a start. Grafana is used by Cern, NASA and many many tech companies like Paypal, Ebay and Digital Ocean and it will surely work for you too :)
You can configure all the thresholds (green/yellow/red) so that they match your needs:
How to get the latest video/screenshot visible in Grafana #
To get the screenshot and video visible in Grafana you need to:
- Set a
--resultBaseURLand the value need to match the Grafana variable resulturl
--copyLatestFilesToBase true. That will make a copy of the last screenshot and video in the base directory so it can be found by Grafana.
- Add a testname/slug to your test with
- Make sure that the screenshot content type
--screenshot.typematches screenshottype variable in Grafana. By default the screenshot type is png.
If you add all that it should work.
In the Grafana panel the path to the screenshot is generated by:
And the video:
If you can’t see the screenshot or the video you can debug it by either inspect the HTML in Grafana, check the network log in devtools (to see if the full URL is correct) or add
<div>$resulturl/$testname/$group.$page.$browser.$connectivity.$screenshottype</div> to the panel so you can see the generated URL.
Setup your own user journey dashboard #
When you import that dashboard you need to add the correct variables. For the login user journey we meausure four pages. When you import that dashboard into Grafana it will look something like this:
You need to define those variables with the configuration you use:
- graphite - your Graphite instance where you store the metrics.
- base - the first part of your
- path - the second part of your
- resulturl - the URL where you display the result, the same setting as
- testname - the name of the test, the value of the
- domain - The domain of the pages you test. To work in Graphite the dots are changed to underscore.
- page1 - The name of the first page. If you use an alias, that is the correct name to use else is the path and page. If you struggle to get this right you can just look in Graphite/Grafana to see what
- page2 - The name of the second page.
- page3 - The name of the third page.
- page4 - The name of the fourth page.
And then if you need to change it later on you can go into the variable section in Grafana.
Configure running your tests
No that you have the dashboards you need to collect metrics. You can collect metrics on one or multiple servers. Do not do it on the same server as the dashboard setup since you want to have an as isolated environment as possible for your tests.
Go to the documentation on how to continuously run your tests and learn how you can do that.
If you run the tests on a standalone server, you need to make sure your agents send the metrics to your Graphite server. Configure
--graphite.host to the public IP address of your server. The default port when sending metrics to Graphite is 2003, so you don’t have to include that.
We provide an example Graphite Docker container for non-production purposes. If you want to put that into production, you need to change the configuration. Check out our own Graphite documentation.
Using S3 for HTML and video
You can store the HTML result on your local agent that runs sitespeed.io, or you can dump the data to S3 or GCS and serve it from there. To use S3, you first need to set up a S3 bucket. For GCS follow the instructions to set up a Google Cloud storage (GCS) bucket.
Then you configure sitespeed.io to send the data to S3 by configuring the bucket name (and AWS key/secret if that’s not available on your server). For GCS you need to provide the name of the bucket, service account key and the project id.
Now, you have the result on S3 or GCS and you’re almost done. You should also configure sending annotations to Graphite for each run.
You can send annotations to Graphite to mark when a run happens, that you can go from the dashboard to any HTML-results page.
You send annotations by configuring the URL that will serve the HTML with the CLI param resultBaseURL (the base URL for your S3 or GCS bucket) and configure the HTTP Basic auth username/password used by Graphite. You can do that by setting
You can also modify the annotation, append your own text/HTML and add your own tags. Append a message to the annotation with
--graphite.annotationMessage. That way you can add links to a specific branch or whatever you deem helpful to you. If needed, set a custom title with
--graphite.annotationTitle instead of the default title that displays the number of runs of the test.
You can add extra tags with
--graphite.annotationTag. For multiple tags, add the parameter multiple times. Just make sure that the tags don’t collide with our internal tags.
Here are a couple of things you should check out before you setup sitespeed.io for production.
Setup (important!) #
To run this in production (=not on your local dev machine) you should make some modifications:
- Always run sitespeed.io on a stand-alone instance
- This avoids causing discrepancies in results, due to things like competing resources or network traffic. Then you just run sitespeed.io with docker run …
- Run Grafana/Graphite on another server instance (only docker compose for Graphite/Grafana).
- Change the default user and password for Grafana.
- Change the default user and password for Graphite.
- Make sure you have configured storage-aggregation.conf in Graphite to fit your needs.
- Configure your storage-schemas.conf to set how long you want to store your metrics.
- MAX_CREATES_PER_MINUTE is usually quite low by default in carbon.conf. That means you will not get all the metrics created for the first run, so you can increase it if you want to. 7, Make sure you disabled tags in Graphite using ENABLE_TAGS = False, see example.
- Map the Graphite volume to a physical directory outside of the Docker container to have better control (both Whisper and graphite.db). Map them like this on your physical server (make sure to copy the empty graphite.db file):
- Remove the sitespeedio/grafana-bootstrap from the Docker compose file, you only need that for the first run.
- Optional: Disable anonymous users access in Grafana.
System Requirements / Memory & CPU #
How large will your instances need to be to run the tests? You need to have enough memory for Chrome/Firefox (yep they can really use a lot of memory for some sites). Before, we used a $80 instance on Digital Ocean (8GB memory, 4 Core processors) but we switched to use AWS c5.large for dashboard.sitespeed.io. We have tried out most cloud providers and at the time AWS gave us the most stable metrics.
To summarize, your test should perform well on (physical or virtual) hardware greater than:
- 8GB Memory
- 4 CPUs
If you test a lot of pages (100+) in the same run, your NodeJS process may run out of memory (default memory for NodeJS is 1.76 GB). You can change and increase the NodeJS max memory per process by setting MAX_OLD_SPACE_SIZE:
docker run -e MAX_OLD_SPACE_SIZE=4096 --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:26.1.0 https://www.sitespeed.io/
Sitespeed.io is Open Source and totally free. But what does it cost to have an instance of sitespeed.io up and running?
Setting up an AWS instance c5.large has an upfront price $515 for a year (it is much cheaper to pay up front). Or you can use an optimized Droplet for $40 a month at Digital Ocean (they have served us well in our testing).
You also need to pay for S3 (to store the videos and HTML). For https://dashboard.sitespeed.io we pay $10-15 per month (depending how long you want to store the data).
Does your organisation already use Graphite/InfluxDB and Grafana? Then use what you have. Otherwise you need to have a server hosting Graphite/Grafana. We pay $20 per month at Digital Ocean for that. Depending on how many metrics and for how long you want to store them, you may need an extra disk. As always, you should also backup your data.
How many runs can you do per month? Many of the paid services, you also pay per run or have a maximum amount of runs. With our one instance at AWS we do 11 runs for 9 different URLs then we run 5 runs for 4 other URLs. That is 119 runs per hour. 2856 per day and 85680 runs per month. We test Wikipedia on our instance so it is possible that your site is a little slower, then you will not be able to make the same amount of runs per month.
- $515 per AWS agent or $480 on Digital Ocean (80000+ tests per month per agent) per year
- S3 $10-15 with data
- Server for Graphite/Grafana
You also need to think of the time it takes for you to set it up and upgrade new Docker containers when there are new browser versions and new versions of sitespeed.io. Updating to a new Docker container on one server usually takes less than 2 minutes :)