
# Isolates

`/actuator/isolates` shows the isolates of the application and how busy each is: the task manager as JSON. Spring Boot has no such endpoint.

## Why

A slow server either computes or waits. The rows tell which: an isolate that computes runs late (`lagMicros`) and is busy (`busy`); one that waits for a database is neither, whatever its requests in flight. With a [pool of server isolates](../spring-boot-starter-web/server/isolates.md) the endpoint also shows whether the isolates share the work, and whether a task isolate is stuck.

## Example

```properties
# lib/resources/application.properties
management.endpoints.web.exposure.include=health,isolates
```

```console
$ curl localhost:8080/actuator/isolates
```

```json
{"isolate": "main",
 "isolates": [
  {"name": "main", "kind": "main", "busy": 0.02, "lagMicros": 180,
   "maxLagMicros": 2100, "active": 3, "memory": 96468992,
   "details": {"requests": 18250}},
  {"name": "isolate-1", "kind": "server", "busy": 0.03, "lagMicros": 210,
   "maxLagMicros": 1900, "active": 2, "details": {"requests": 18102}}]}
```

## What is listed

| Key | Content |
|---|---|
| `isolate` | The name of the isolate that answered this request |
| `isolates` | One row per isolate the application knows about |

The rows are those of the `isolateLoads` bean (see [The load of the isolates](../spring-core-dart/isolates/load.md)):

- the application's first isolate, `main`, with the memory of the process;
- the isolates of the web server's pool, `isolate-1`, …;
- the isolates of the [task executor](../spring-core-dart/isolates/task-executor.md), `task-1`, …, while they exist;
- what the application shows itself with `IsolateLoads.track`, and the rows of its own `IsolateLoadSource` beans.

| Field of a row | Meaning |
|---|---|
| `name` | The isolate's name, as in the logs |
| `kind` | `main`, `server`, `task`, `engine`, `tracked`, or a source's own word |
| `busy` | The share of the time it was working, from 0 to 1 |
| `lagMicros` | How late its event loop ran a timer, on average over the last seconds, in microseconds |
| `maxLagMicros` | The longest lag of that time |
| `active` | What it is working on now: requests in flight, tasks running |
| `memory` | The resident memory of the process in bytes; on the `main` row only, since isolates share it |
| `details` | What one source adds: `requests` (all the isolate has taken), `refused` (answered 503 because the server was full), `tasks` and `queued` of a task isolate |

A number a source cannot measure is left out.

## Measuring starts with the first request

Nothing is measured while nobody asks. The first request starts the measuring, so its answer has no `busy` and no lag yet; ask again a few seconds later. Thirty seconds after the last request the measuring stops by itself.

So a monitor that asks every 10 seconds gets numbers from its second request on, and an application nobody watches pays nothing.

`busy` and the lag are estimates from inside the program, not processor time. What they can and cannot tell is on [The load of the isolates](../spring-core-dart/isolates/load.md#how-lag-and-busy-are-measured).

## With a pool of isolates

A request reaches any isolate, and so does a request for this endpoint. The answer is the same whichever isolate takes it:

- The endpoint asks the application's first isolate, which knows every isolate. The first isolate asks the others for their numbers and answers every row.
- **`isolate` names the isolate that took the request**, not the one that knows. It changes from one request to the next; the rows do not depend on it.
- The rows of the other isolates are as fresh as that question: an isolate that does not answer within a second keeps its last row.

## Exposure

The endpoint is enabled by default but, like every endpoint except `health`, not exposed over HTTP. Add `isolates` to `management.endpoints.web.exposure.include`, or use `*`:

```properties
management.endpoints.web.exposure.include=health,isolates
```

The rows show how loaded the server is, which is worth knowing to someone who wants to overload it: protect the endpoint (see [Security](security.md)). `management.endpoint.isolates.access=none` turns it off.

The endpoint is the bean `isolatesEndpoint` of `spring_boot_starter_actuator`; it backs off when the application declares an `IsolatesEndpoint`. It asks through the `primaryIsolate` bean (handler `isolates.loads`); see [Asking the first isolate](../spring-core-dart/isolates/primary-isolate.md).

## In Spring (Java)

Spring Boot Actuator has no counterpart: a JVM's threads share their beans. Nearest is the `threaddump` endpoint.

## See also

- [Endpoints](endpoints.md)
- [Requests per second](qps.md)
- [Security](security.md)
- [The load of the isolates](../spring-core-dart/isolates/load.md)
- [Asking the first isolate](../spring-core-dart/isolates/primary-isolate.md)
- [A pool of isolates](../spring-boot-starter-web/server/isolates.md)
- [The task manager of a Flutter app](../spring-boot-starter-flutter/isolates.md)
