/pressure API
The /pressure API returns real-time system load information for your Browserless instance, and is available for both self-hosted and dedicated accounts.
Querying system pressure
Issue a GET request to /pressure to check current load:
- cURL
- Javascript
- Python
- Java
- C#
curl -X GET \
https://production-sfo.browserless.io/pressure?token=YOUR_API_TOKEN_HERE
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/pressure?token=${TOKEN}`;
const fetchPressure = async () => {
const response = await fetch(url, {
method: 'GET'
});
const result = await response.json();
console.log(result);
};
fetchPressure();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/pressure?token={TOKEN}"
response = requests.get(url)
result = response.json()
print(result)
import java.io.*;
import java.net.URI;
import java.net.http.*;
public class FetchPressure {
public static void main(String[] args) {
String TOKEN = "YOUR_API_TOKEN_HERE";
String url = "https://production-sfo.browserless.io/pressure?token=" + TOKEN;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.GET()
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Response: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main(string[] args) {
string TOKEN = "YOUR_API_TOKEN_HERE";
string url = $"https://production-sfo.browserless.io/pressure?token={TOKEN}";
using var client = new HttpClient();
try {
var response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response: " + result);
} catch (Exception ex) {
Console.WriteLine($"Error: {ex.Message}");
}
}
}
Running this request will result in a JSON output like:
{
"pressure": {
"cpu": 45,
"memory": 62,
"isAvailable": true,
"maxConcurrent": 10,
"maxQueued": 10,
"running": 3,
"queued": 0,
"reason": "",
"recentlyRejected": 0,
"date": 1711468800000,
"message": ""
}
}
Response fields
| Field | Type | Description |
|---|---|---|
cpu | number or null | CPU usage percentage |
memory | number or null | Memory usage percentage |
isAvailable | boolean | Whether the instance accepts new sessions |
maxConcurrent | number | Maximum concurrent browser sessions |
maxQueued | number | Maximum queued requests |
running | number | Currently running sessions |
queued | number | Currently queued requests |
reason | string | Why the instance is unavailable: full, cpu, memory, or empty |
recentlyRejected | number | Recent rejected connection count |
date | number | Timestamp of the response in milliseconds |
message | string | Additional status message |
Common use cases
Use /pressure to check whether your instance can handle another connection before starting a new session. This is especially useful for:
- Load balancing: Route traffic to instances with available capacity (see NGINX Load Balancing)
- Auto-scaling: Trigger scale-up when
isAvailableisfalseorrunningapproachesmaxConcurrent - Health monitoring: Integrate with external monitoring systems to track resource usage over time
- Queue management: Check
queuedcount to detect when requests are backing up