Grafana Cloud

# VU hours

Grafana Cloud k6 subscriptions are based on usage in Virtual User Hours (VU hours, or just VUH).

A VU is an independent thread of execution that runs concurrently to other VU threads. Often, scripts are designed in such a way that one VU activity represents that of one real user.

VUH are deducted for both cloud execution (`k6 cloud run`) and cloud streaming (`k6 run --out cloud`).

Note

The metering algorithm has been updated on Jul 13, 2023. Customers who purchased Grafana Cloud k6 before this date need to contact their account team to discuss making a change.

## VUH calculation

For the purposes of VUH calculation, there are two types of VUs:

• Protocol VUs - these are VUs calling API endpoints. They often represent the main portion of a test.
• Browser VUs - these are VUs employing a web browser to test frontend functionality.

The total number of VUs in your test is the sum of Protocol VUs and Browser VUs.

The formula to calculate the number of VUH used by a test depends on your subscription.

### Fractional VUH plans

For users on a fractional VUH plan, the cost of running Protocol VUs is calculated using the following formula:

(Maximum number of VUs x test execution duration in minutes) / 60 minutes = VUH

For example, if your test ramps up to a maximum of 100 VUs and runs for 10 minutes, the test run will use 16.67 VUH ((100 VUs x 10 minutes)/60 = 16.67 VUH).

The cost of running Browser VUs is calculated using the following formula:

(10 x Maximum number of VUs x test execution duration in minutes) / 60 minutes = VUH

In effect, 1 Browser-VU costs the same as 10 regular protocol-testing VUs. Another way of thinking of this is that 1 VUH gets you 6 minutes of browser-VU time.

In a test that uses both protocol and browser capabilities, you only pay for the types of VUs that you use. For example, if you run a 5-minute 11 VUs test, where 10 of those VUs are Protocol VUs and 1 is a Browser VU, you’d pay:

• 1.67 VUH for the 10 protocol VUs.
• 1.67 VUH for the single browser-running VU.

The total cost for the test would be 1.67 + 1.67 = 3.34 VUH.

Note that VU hours are calculated based on the period that the test run executes, not the pre-configured test duration. If the test duration is two or more hours but only runs for 30.01 minutes, then the subscription will be charged for the test-execution period rounded up to the next minute (in this case, 31 minutes).

The minimum cost for a test is 1 VUH. If a test uses both protocol and browser-VUs, the minimum cost is 2 VUH.

### Full VUH plans

For users on a full VUH plan, the cost of running Protocol VUs is calculated using the following formula:

Maximum number of VUs x test execution duration rounded up to the next hour = VUH

For example, if your test ramps up to a maximum of 100 VUs and runs for 10 minutes, the test run will use 100 VUH (100 VUs x ROUNDUP(10/60) = 100 VUH).

The cost of running Browser VUs is calculated using the following formula:

(Maximum number of VUs x test execution duration rounded up to the next hour) * 10 = VUH

In a test that uses both protocol and browser capabilities, you only pay for the types of VUs that you use. For example, if you run a 5-minute 11 VUs test, where 10 of those VUs are Protocol VUs and 1 is a Browser VU, you’d pay:

• 10 VUH for the 10 protocol VUs.
• 10 VUH for the single browser-running VU.

The total cost for the test would be 10 + 10 = 20 VUH.

### Arrival-rate executor calculation

k6 has two executors that you can use to set the test load in terms of RPS (requests per second): constant arrival rate and ramping arrival rate.

When using arrival-rate executors, the calculation for VUH changes. Instead of the formula using the maximum number of VUs, it uses two variables you can set for those scenarios: `preAllocatedVUs`, and `maxVUs`, with `maxVUs` taking precedence.

For a fractional VUH subscription, you can use the following formula:

(`maxVUs` or `preAllocatedVUs` x test execution duration in minutes) / 60 minutes = VUH

And for a full VUH subscription, you can use the following formula:

`maxVUs` or `preAllocatedVUs` x (test execution duration in minutes rounded up to the next hour) = VUH

The same 10x multiplier for VUs using browsers apply here too.

In cloud tests with arrival-rate executors, it’s important to properly allocate VUs to meet your RPS target and avoid unnecessary costs from VUs over-provisioning.

For more information on how to allocate VUs in arrival-rate executors, refer to:

## Save on VUH by starting locally

To save on VU hours, prototype and debug scripts on a local machine. After you have the correct logic, increase the load and duration to the desired levels, then run the script with `k6 cloud run` for managed execution, visualization, and storage.