Automate concrete5 site performance testing with blackfire

MD Biplob Hossain
MD Biplob Hossain

Automation is key to continuously manage application performance. Blackfire provides a feature that helps developers trigger performance tests on an application and be alerted whenever a problem occurs. We can set it up only in five minutes.

Noted that, this is only available to Premium and Enterprise Users.

Assuming you already have setup blackfire on your server. If not, then set it up with this instruction
Now, let’s start with the summary-

Description

  • Create a file named .blackfire.yml on your project root. vi .blackfire.yml
  • Put the following codes into the file.
# This is the test cases, which we want to test
# To know more, visit https://blackfire.io/docs/cookbooks/tests
tests:
    Pages should be fast enough:
        path: /.*
        assertions:
            - main.wall_time < 800ms
            - main.io < 200ms
            - main.cpu_time < 600ms
    Pages should not consume too much memory:
        path: /.*
        assertions:
            - main.memory < 50M
            - main.peak_memory < 75M
    Pages should not do too many SQL queries:
        path: /.*
        assertions:
            - metrics.sql.queries.count <= 12
    Pages should be light:
        path: /.*
        assertions:
            - metrics.output.network_out < 200KB
    Pages should not become slower:
        path: /.*
        assertions:
            - percent(main.wall_time) < 30%
            - diff(metrics.sql.queries.count) < 2

# This is scenarios/pages, we want to test. You can add more pages as your requirement.
# To know more, visit https://blackfire.io/docs/cookbooks/scenarios
scenarios:
    Homepage:
        - /
    Login:
        - /login
  • Save and exit.

  • Login to your blackfire dashboard.

  • Select Create Environment button.
    screen-1.png

  • Enter Environment Name & Environment Endpoint. The endpoint is your website address.
    screen-2.png

  • You can save the settings as your requirment or save as it is.
    screen-3.png

  • You will get a successful message with server Id and token. Close the popup and go to your builds section.
    screen-4.png

  • You’ll get a right panel with Builds and Configurationsection. You can change it as your requirement.
    screen-5.png

  • If you’re not Enterprise user, then you’ve to wait for Periodic Builds. By default it’s on every 6 hours. You can change it down to 1 hour. Select the edit icon of Periodic Builds on right top. Change the frequency to Every hour. Select Test button to test your settings under Advanced settings.
    screen-6.png

Now, wait for the Periodic build.

References