Requests per second

/actuator/qps answers how many requests per second the server took in the last window, how long they took and how many failed, for every isolate and in total. It is the JSON of the web starter's debug feature qps, and exists only when that feature is in the build.

Why

The feature logs one line per window. A load test, a dashboard or a script wants the same numbers as data, and wants them at a moment of its own choosing: after each step of a test, not every ten seconds.

Example

# lib/resources/application.yml
spring:
  web:
    debug:
      qps:
        enabled: true      # read by the build: run build_runner after changing it
management:
  endpoints:
    web:
      exposure:
        include: health,qps
$ curl localhost:8080/actuator/qps
{"seconds": 10.0, "qps": 1250.4, "requests": 12504, "errors": 0,
 "active": 14, "p50Micros": 1139, "p95Micros": 5767, "p99Micros": 8650,
 "isolates": {
   "main": {"qps": 412.0, "requests": 4120, "errors": 0, "active": 5,
            "p50Micros": 1139, "p95Micros": 5767, "p99Micros": 8650},
   "isolate-1": {"qps": 420.2, "...": "..."},
   "isolate-2": {"qps": 418.2, "...": "..."}}}

The two requests

Request Answer
GET /actuator/qps The last window, as long as spring.web.debug.qps.log-interval (10 seconds). {} before the first window has passed
GET /actuator/qps/now Ends the window now and answers it
GET /actuator/qps/<anything else> 404

/now is for a load test that reads after each step: the answer covers exactly the time since the last look.

What is answered

Key Meaning
seconds The length of the window
qps Requests per second, one decimal
requests The requests answered in the window
errors Those answered with a 5xx status, or that ended with an error
active The requests in flight at the end of the window
p50Micros, p95Micros, p99Micros The latency under which half, 95 % and 99 % of the requests were answered, in microseconds; left out without requests
isolates The same numbers for each isolate by name, the first isolate first

The percentiles are bounds of latency buckets, not exact times: a value is at most half as much again as the real one. What is counted and what is not (the wait for the isolate, requests refused as full) is on the feature's page.

With a pool of isolates

The numbers are those of every isolate, added up in the first one. The endpoint exists in every isolate and asks the first one (through the primaryIsolate bean, handler web.qps), so the answer is the same whichever isolate takes the request.

/now ends the one window of the application, whichever isolate is asked.

Exposure

The endpoint exists when the build has the feature (spring.web.debug.qps.enabled: true in application.yml or application.properties, without a profile). Then it is enabled by default and, like every endpoint except health, not exposed over HTTP until qps is in management.endpoints.web.exposure.include.

Without the feature, /actuator/qps is a 404 whatever is exposed: there is no qpsEndpoint bean, and no code that counts.

management.endpoint.qps.access=none turns the endpoint off and leaves the log line. Protect it like the others (see Security).

In Spring (Java)

Spring Boot's counterpart is the metrics endpoint with Micrometer's http.server.requests timer. That is a metrics system; this is the last window of a debug feature.

See also