Performance/WebPageTest/Run locally

From Wikitech
Jump to navigation Jump to search

Running a WebPageTest instance on your local machine has been made a lot easier in 2017 with the support for Linux agent. The agent is still experimental but it is a good start for us to be able to fix bugs and test things locally. But we are still running the Windows version on our test agents (we will switch when we feel Linux supports what we need).

Mac OS X

On my local I run a server and an agent. I rarely (or never) do any changes on the server so I run them using the provided Docker containers.

# Start the server on port 4001
docker run -p 4001:80 --rm webpagetest/server

# Switch to another terminal
# Start the agent
docker run --rm \
-e SERVER_URL="http://192.168.65.1:4001/work/" \
-e LOCATION="Test" \
-e SHAPER="none" \
--cap-add=NET_ADMIN \
webpagetest/agent

Access http://localhost:4001/ and you should see the server interface. Choose the Test location and run your test.

WebPageTest will kill the current browser sessions, so if you want to run your test on Firefox, go to the server in Chrome and vice verse.

Known issues

  • The video isn't working at all at the moment when you run locally in Docker (on Mac OS X).
  • I've seen issues where the video becomes all kind of colors and not recording the browser, but I haven't been able to pinpoint the problem.