Documentation / Performance Dashboard

Performance Dashboard

Monitor the performance of your website using the performance dashboard.

Using Docker compose

If you don't use Grafana/Graphite already, we have prepared a Docker Compose file that downloads and sets up Graphite/Grafana 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 there are no pre-made dashboards for it.

Pre-Requirements

Before you start, make sure you have the following installed:

Instructions

  1. Clone the Repository

    Open a terminal window and clone the sitespeed.io repository by running the following command:

    git clone https://github.com/sitespeedio/sitespeed.io.git
  2. Navigate to the Docker Directory

    Navigate to the docker directory in the cloned repository:

    cd sitespeed.io/docker
  3. Run Docker Compose

    In the terminal, run the following command:

    docker compose up

    This command will download the necessary Docker images and start Grafana and Graphite.

  4. Add example data

    To push data for the page metric dashboard (the most important dashboard) you can run a test like this:

    sitespeed.io https://www.sitespeed.io -n 1 --slug myTest --graphite.host 127.0.0.1 --graphite.addSlugToKey true
  5. Access Grafana

    Once the services are up and running, you can access the Grafana dashboard by opening a web browser and navigating to http://localhost:3000. If you want to edit the dashboards, the default login is sitespeedio and the password is... well, check out the docker-compose.yml file.

  6. Stop docker compose

    When you're done, you can stop the services by pressing Ctrl+C in the terminal where you ran docker compose up. To completely remove the services and volumes defined in the docker-compose.yml file, you can run docker compose down.

Remember, these are simplified instructions. For a production setup, you would need to make additional configurations, such as setting up persistent storage and securing the Grafana dashboard.

Pre-made example dashboards

We insert ready-made dashboards with our docker compose file using provisioning. You can check out the compose file and use it as an example.

Hover the (i) next to a dashboard name or a panel title to see what it shows and which option you need to collect the data.

Some of our dashboards use Grafana plugins. To make sure the dashboards work you need to install these plugins:

In our Docker file you can see something like this:

 environment:
        - GF_PLUGINS_PREINSTALL_SYNC=yesoreyeram-infinity-datasource@4.1.6,marcusolsson-dynamictext-panel@6.3.1
        ...

Earlier versions of the dashboards used the JSON API datasource (marcusolsson-json-datasource). Grafana recommends the Infinity datasource instead. If you upgrade, install the Infinity plugin and add an Infinity datasource with the UID infinity. Do not set a base URL on it. Our datasource provisioning file does that for you.

The Page metrics dashboard shows metadata like settings/video/screenshots. To get that dashboard to work correctly, you need to push the result of your test to S3 or a web server and set up the dashboard to point to where you store the sitespeed.io result.

In our example dashboard we serve our content from https://data.sitespeed.io, so we configure the variable resulturl for the dashboard to point there. That way we will see screenshots, videos and metadata like how you configured your tests in the dashboard. The dashboards in our Docker compose setup are the same dashboards that run on dashboard.sitespeed.io, so resulturl is https://data.sitespeed.io. Change it to where you store your result.

Export URL in page metrics dashboard

If that is set up correctly, your dashboard will look something like this:

Screenshots and other meta data

Example dashboards

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:

Page 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 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

You should use these as example dashboards to inspire what you can do. We try to squeeze all the data into these dashboards.

The page metrics shows metrics for a specific URL/page.

The dashboard looks something like this: Page metrics

The dashboard has tabs: Overview, Google Web Vitals, Visual metrics, Timings, Size and requests, CPU, Quality, Test stability and Regressions. Grafana only gets the data for a tab when you open it, so the dashboard loads faster than when all rows were on one page.

The timing tiles in the overview show how much each metric changed from the start to the end of the time range. The Google Web Vitals tab starts with a status strip, where each metric is green (good), yellow (needs improvement) or red (poor) over time, using the limits from Google. Each graph has the same colors in the background and shows:

  • each test (the median of the runs, or what you choose in function), with a band from the fastest to the slowest run, so you can see if a change is bigger than the difference between runs.
  • the average of the last 24 hours and the same average one week earlier.
  • a trendline, so you can see if a metric gets better or worse over the time range.

If you also collect Chrome User Experience Report data with --crux.key in the same test, the tab shows your lab metrics and the field metrics (75th percentile) from real Chrome users in the same graph.

The Visual metrics tab shows the metrics from the video (First Visual Change, Speed Index, Largest Image, Largest Heading, the visual Largest Contentful Paint and Last Visual Change) the same way as the Google Web Vitals, and when the page is 85, 95 and 99% visually complete. The tab only shows when the test records a video.

The Regressions tab shows how many tests failed. If you compare your tests against a baseline, it also shows how many metrics got slower in the last comparison, which metrics they are and how large the effect is (small, medium or large), and the changes over time. A link opens the comparison in the latest HTML result, where you see the medians and every run (needs --copyLatestFilesToBase). Faster metrics only show when there are any: by default compare only looks for regressions, add --compare.alternative two-sided to also find improvements.

Some rows need a configuration, for example the CPU rows need --cpu (Chrome and Edge), the axe rows need --axe.enable, the carbon emission row needs --sustainable.enable and the regression panels need --compare.id. The dashboard only shows a row when the test has data for it, and the CPU tab only when there is CPU data. In the rows, a panel without data is not shown, so you only see the panels for the data you collect.

The links Leaderboard and Chrome User Experience Report at the top open these dashboards for the same time range.

The Page metrics, Leaderboard, Chrome User Experience Report and User journey dashboards use the dashboard format of Grafana 13 (dynamic dashboards), because older formats cannot have tabs or hide rows and panels without data. They need Grafana 13 or later.

Page metrics example 2

User journey dashboard

The User journey dashboard works for every user journey (scripted test) without changes. Choose the test with path, testname and domain, and the dashboard shows one tab for each page: the screenshot and video from the last run, the timings, the Google Web Vitals, the number of requests and the transfer size. Use page to show only some of the pages. The order of the tabs is alphabetical, not the order of the pages in your script.

The leaderboard

We are so proud of our leaderboard dashboard that it got its own documentation page. Use the dashboard if you want to compare different sites or URLs.

Leaderboard

Chrome User Experience Report

Using our Chrome User Experience Report plugin you can get the metrics Chrome collects from real users. We have a ready made dashboard where you can look at the data on URL and origin level.

CruX

OpenSearch

You can also send the results to OpenSearch with --opensearch.host. Graphite stores numbers on a fixed path. OpenSearch stores every test as a document with text fields, so for the URL you choose, the OpenSearch dashboard can do what the Graphite dashboards cannot:

  • List the latest tests with a link to each HTML result (needs --resultBaseURL).
  • Group the results by any field when you look at them, for example by browser.
  • Keep every run, not only the median, and show how the runs are spread (add --opensearch.includeRuns).
  • Show which metrics changed in a comparison.
  • Keep two tests of the same URL apart, for example a WebPageReplay test and a first-view test: give each test its own --slug and pick it in the Test dropdown.
  • Filter on any other field, for example the group.

Our Docker compose file starts OpenSearch and provisions the data sources. OpenSearch in that file has no login, so do not let anyone except your test servers reach port 9200.

When sitespeed.io starts, it adds the index templates and the retention policies to OpenSearch. The user that sitespeed.io logs in with must be allowed to change them. sitespeed.io deletes the summary indices after 90 days (--opensearch.retentionDays) and the run indices after 7 days (--opensearch.runRetentionDays). A template that you changed in OpenSearch stays, until a new sitespeed.io version comes with a new version of that template. A new template is only used for the indices that OpenSearch creates after it, and sitespeed.io creates a new index every day.

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 check out the basic concepts as a start. Grafana is used by CERN, NASA and 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:

Configure thresholds in Grafana

How to get the latest video/screenshot visible in Grafana

To get the screenshot and video visible in Grafana you need to:

  • Set a --resultBaseURL and the value needs to match the Grafana variable resulturl.
  • Set --copyLatestFilesToBase true. That will make a copy of the last screenshot and video in the base directory so it can be found by Grafana.
  • Set --copyLatestFilesToBaseGraphiteNamespace true. That adds your Graphite namespace (--graphite.namespace) first in the file name, the way our dashboards expect it.
  • Add a testname/slug to your test with --slug.
  • Make sure that the screenshot content type --screenshot.type matches the 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: $resulturl/$testname/$base.$path.$group.$page.$browser.$connectivity.$screenshottype

And the video: $resulturl/$testname/$base.$path.$group.$page.$browser.$connectivity.mp4

If you can't see the screenshot or the video you can debug it by either inspecting the HTML in Grafana, checking the network log in DevTools (to see if the full URL is correct), or adding <div>$resulturl/$testname/$base.$path.$group.$page.$browser.$connectivity.$screenshottype</div> to the panel so you can see the generated URL.

Set up your own user journey dashboard

When you import that dashboard you need to add the correct variables. For the login user journey, we measure four pages. When you import that dashboard into Grafana it will look something like this:

Import a user journey variables

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 --graphite.namespace.
  • path - the second part of your --graphite.namespace.
  • resulturl - the URL where you display the result, the same setting as --resultBaseURL.
  • testname - the name of the test, the value of the --slug parameter.
  • domain - the domain of the pages you test. To work in Graphite, the dots are changed to underscores.
  • page1 - the name of the first page. If you use an alias, that is the correct name to use; otherwise it's the path and page. If you struggle to get this right, you can just look in Graphite/Grafana to see what to use.
  • 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. Import a user journey variables

Configure running your tests

Now 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 as isolated an 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.

Configure Graphite

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 an 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, the 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.

Annotations

You can send annotations to Graphite to mark when a run happens, so 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 --graphite.auth LOGIN:PASSWORD.

The HTML result is uploaded when all pages in the run are tested. If you upload it with S3, GCS, scp or rsync, sitespeed.io sends the annotations after the upload, so the link in an annotation always works. The metrics are sent to Graphite as soon as each page is tested, and each annotation is placed at the time its page was tested.

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.

If you don't store the HTML result where a browser can reach it (for example when the report is kept as a CI artifact), you can still send annotations without resultBaseURL: set --graphite.annotationTitle or --graphite.annotationMessage (or the --grafana.* versions) and the annotation is sent without links to the result.

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.

Production Guidelines

Here are a couple of things you should check out before you set up sitespeed.io for production.

Setup (important!)

To run this in production (=not on your local dev machine) you should make some modifications:

  1. 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).
  2. Change the default user and password for Grafana. They are in the Docker Compose file, which everyone can read on GitHub.
  3. Only open the ports that your test machine needs, and only to that machine. Graphite and OpenSearch do not ask for a password in our setup, so anyone who reaches them can send and read metrics, and in OpenSearch also delete data. The test machine needs port 2003 (metrics) and 8080 (annotations) on Graphite, and 9200 only if you use the OpenSearch plugin. Grafana reaches Graphite and OpenSearch inside the Docker network, so it does not need these ports. If you run the tests on the same server, remove the ports from the Docker Compose file.
  4. Docker opens the ports that a container publishes also when your firewall (for example ufw) blocks them. Block them in the DOCKER-USER chain, see Docker with iptables in the Docker documentation.
  5. Make sure you have configured storage-aggregation.conf in Graphite to fit your needs.
  6. Configure your storage-schemas.conf to set how long you want to store your metrics.
  7. 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.
  8. Make sure you disabled tags in Graphite using ENABLE_TAGS = False, see example.
  9. 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 by browser or by CLI: wget https://github.com/sitespeedio/sitespeed.io/raw/main/docker/graphite/graphite.db):
  • /path/on/server/whisper:/opt/graphite/storage/whisper
  • /path/on/server/graphite.db:/opt/graphite/storage/graphite.db
  1. Optional: disable anonymous user access in Grafana.

System Requirements / Memory & CPU

To ensure smooth performance while running tests with sitespeed.io, it is important to have sufficient memory for Chrome and Firefox, as they can require a significant amount of memory for certain websites. In the past, we have used an $80 instance on Digital Ocean (8GB memory, 4 Core processors), but currently, we use a bare metal server at Hetzner for our dashboard.sitespeed.io. We have found that bare metal servers provide the most stable metrics.

In summary, for optimal performance, your test environment should have the following minimum hardware specifications:

  • 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:43.0.0 https://www.sitespeed.io/

Cost

Sitespeed.io is an open-source tool that is completely free to use. However, there are some costs associated with running an instance of the tool.

For optimal performance, we recommend using a bare-metal server from Hetzner. This is what we use for our own instances and it is available for less than $500 per year.

Alternatively, you can use an AWS instance c5.large, with an upfront price of $515 per year. Or you can use an optimized Droplet for $40 a month from Digital Ocean.

You will also need to pay for S3 storage to store the videos and HTML or choose to host them yourself.

Overall, the cost of running an instance of Sitespeed.io will depend on your specific setup and usage. However, with the flexibility of the cloud hosting providers, you can scale up or down as needed, so you only pay for what you need.

If your organization already uses Graphite/InfluxDB and Grafana, continue using them. If not, you will need to set up a server to host them. Hosting costs can be around $20 per month on platforms such as Digital Ocean. Keep in mind that the amount of storage needed may vary based on the amount of metrics being collected and how long they are being stored for. Remember to always backup your data.

The number of runs that can be done per month can vary depending on the service being used. Some paid services charge per run or have a limit on the number of runs. Our organization uses one instance on AWS and can perform 11 runs for 9 different URLs, followed by 5 runs for 4 other URLs. This results in a total of 119 runs per hour, 2856 runs per day, and 85680 runs per month. Keep in mind that these numbers are based on testing Wikipedia on our instance and your site may be slower, resulting in a lower number of runs per month.

Total cost:

  • $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 :)