Skip to content
This page View Markdown Open in ChatGPT Open in Claude
WebSocket benchmark · Linode (Akamai Cloud) · Shared CPU · 14 October 2026

4 vCPU, 8 GB RAM : 801,972 WebSocket clients connected at once.

API Maker 4.0.0 on a Linode 8 GB (g6-standard-4) : 4 shared vCPUs and 8 GB of RAM at $48 a month, its MongoDB and Redis on the same machine. A second server opened WebSocket clients, each with both tokens and a subscription of its own, until the memory of the server was full, while autocannon made the calls which notify them : every run 60 seconds, the memory and CPU of every part sampled each second.

Clients connected 801,972 the memory was full : 1,005 MB left
Memory per client 8.7KB API Maker 3.3 · kernel 4.4 · Redis 1.1
New clients / second 7,009 both tokens and a subscription · 12,826 without one
Notification delivered in 1.06ms p50 at 1,000 a second · p99 2.03 ms

The server

Server Linode (Akamai Cloud), Linode 8 GB (g6-standard-4), shared cpu, $48 / month
CPU AMD EPYC 7642 48-Core Processor, 4 shared vCPUs (KVM)
KVM guest, 1 thread per core · L1d 256 KiB (4 instances) · L2 2 MiB (4 instances) · L3 64 MiB (4 instances) · BogoMIPS 4600.00
Memory 8 GB (7,941 MB usable), swap 8.3 GB (496 MB of Linode + 7.8 GB made by the installer)
Disk, region 160 GB SSD, Mumbai, India (ap-west)
System Ubuntu 24.04.4 LTS, Linux 6.8.0-134, Docker 29.9.0
API Maker 4.0.0 : release build of api_maker_be_rust 423a34c with the new WebSocket core of 14 October 2026 (opt-level 3, fat LTO), installed by its installer (https://apimaker.dev/v4/install.sh), no reverse proxy
Settings the defaults of the installer : one worker thread per vCPU, up to 2,032,896 open files for the service (LimitNOFILE), and the sandboxes kept running for the whole run (removeSandboxInactiveSinceMinutes 1440)
Network limits as the installer sets them : 2,032,896 connections tracked by the firewall of Linux (net.netfilter.nf_conntrack_max), 16,384 waiting to be accepted (net.core.somaxconn). The memory of all its TCP connections together : raised by API Maker as the clients came, to 1.9 GB at the most (net.ipv4.tcp_mem, 25 % of the memory ; Linux gives 9 %)
Databases MongoDB 8.0.10 (the MongoDB of API Maker, a replica set of one member, in Docker) · Redis 7.0.5 (the Redis of API Maker, in Docker) : on the same server. No other database runs
Sandboxes TypeScript on Node.js 24.21.0 (an image of 404 MB built by API Maker), 2 sandboxes of the account (sandboxCountForAdmin 2, the default)
Load generator Dedicated 16 GB (g6-dedicated-8) : AMD EPYC 7642 48-Core Processor, 8 dedicated vCPUs, Ubuntu 24.04.4 LTS. The WebSocket clients : am_ws_load, a program in Rust made for these benchmarks, a socket and a task per client, from 41 addresses of the load generator. The HTTP calls : Node.js 24.21.0, autocannon 8.0.0
Network A VLAN of the same data centre, round trip 0.30 ms (ping)
Date 14 October 2026, 03:17 to 03:58 UTC

Only what the run needs was running : API Maker and its two sandboxes, its MongoDB and its Redis. API Maker was restarted and the swap emptied before the run. How every number was taken : How the WebSocket benchmarks are made. Every server side by side : All results. The APIs of this server : 4 vCPU · 8 GB, API benchmark.

The data

  • The clients connect to ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token> : the token of an API user, and the token of a person, a row of the customers table of the benchmark dataset (https://apimaker.dev/json/benchmark_dataset.json) made by a DB token generator. API Maker checks both.
  • A subscription is one REGISTER for the custom WebSocket event order-updates with a condition of its own : { conditionType: 'RESPONSE', criteria: { recipientId: '<the number of the client>' } }. It is the way one notification reaches one person.
  • A notification for one person is 141 bytes ; a row of the dataset told to the clients of a table is 321 bytes.
  • The tables are the ones of the API benchmarks, in MongoDB : ten rows of customers, ten columns each.

Results at a glance

New clients per second
Subscribe : the code reads the databasethe code ran in the sandbox2,735
Subscribe : the code reads the clockthe code ran in the sandbox5,243

100 clients at a time connect, are let in and leave, for 60 seconds.

Notifications per second
A notification for one person13,711 calls / second13,441
A broadcast150 calls / second147,974
Rows inserted in a table932 calls / second92,279

As many calls as the server takes : what the clients received each second.

How many clients fit

Clients connect 4,000 a second, level after level, each with both tokens and a subscription of its own ; at each level they wait 30 seconds while the server is sampled (the level the run stops at, 60). The run stopped adding clients at 801,972 : the memory of the server was full. 996 MB of its 7,941 MB were still counted as available, and Linux had moved 606 MB to the swap since the clients began to connect, to make that room : 390 MB were left (the run stops when what is available, less what Linux moved to the swap since the clients began to connect, is under 5 % of the memory of the server).

Clients connected and memory used during the run 00 MB200k1.9 GB401k3.9 GB601k5.8 GB802k7.8 GB 0 min7 min14 min21 min28 min35 min clients connected memory used, of 7.8 GB
API MakerMongoDB of API MakerRedisSandboxesLinux : its sockets, Docker, the restAvailable
No client
at rest
10,000 clients
connected
50,000 clients
connected
100,000 clients
connected
200,000 clients
connected
300,000 clients
connected
400,000 clients
connected
500,000 clients
connected
600,000 clients
connected
700,000 clients
connected
800,000 clients
connected
801,972 clients
connected
Clients API Maker Redis Kernel MongoDB Sandboxes Server, used Available Swap CPU busy
None (at rest) 118 1 229 123 57 879 7,063 0 0.9 %
10,000 158 12 327 158 482 1,474 6,467 0 1.5 %
50,000 283 52 458 217 482 1,786 6,155 0 1.2 %
100,000 437 103 682 214 482 2,180 5,761 0 2.3 %
200,000 765 203 1,130 214 481 3,006 4,935 0 3.2 %
300,000 1,086 313 1,580 214 481 3,799 4,143 0 4.6 %
400,000 1,389 406 2,008 214 481 4,508 3,433 0 8.1 %
500,000 1,733 498 2,430 214 481 5,294 2,647 0 10.2 %
600,000 2,030 625 2,850 214 481 6,082 1,859 0 12.4 %
700,000 2,313 716 3,276 203 428 6,795 1,146 68 15.0 %
800,000 2,497 810 3,712 67 208 6,935 1,006 567 15.3 %
801,972 2,495 812 3,715 64 206 6,937 1,005 609 12.9 %

Memory in MB. API Maker is the resident memory of its process ; Redis is the memory of its data (used_memory) ; the kernel of Linux keeps every socket and every tracked connection in its slab ; a container is counted the way docker stats counts it. CPU busy is the whole server while the clients wait : the server pings every client once a minute, and each answers.

Memory when the server is full

With 801,972 clients connected and waiting, of the 7,941 MB of the server :

Part At rest, no client 801,972 clients More
API Maker (process) 118 MB 2,495 MB + 2,377 MB
Redis (container) 3 MB 808 MB + 805 MB
Linux kernel : sockets, tracked connections (slab) 229 MB 3,715 MB + 3,486 MB
MongoDB of API Maker (container) 123 MB 64 MB − 59 MB
Sandboxes (2 containers) 57 MB 206 MB + 149 MB
Whole server, used 879 MB 6,937 MB + 6,058 MB
Available 7,063 MB 1,005 MB
Swap used 0 MB 609 MB
Open files of API Maker 28 802,004
Keys of Redis · channels it listens on 13 · 5 1,603,960 · 801,977

MongoDB and the sandboxes grew during the runs before this one (the inserts, the code of the events), not with the clients.

What a client costs

Between 200,000 and 600,000 clients (5 levels), each client more cost the server 8.7 KB :

Where Per client What it is
API Maker 3.3 KB The client itself : its socket and the one task which reads it, its tokens and what they said, its subscription and the channel it is told on.
Linux kernel 4.4 KB The TCP socket, and the entry of the connection in the table of the firewall (Docker makes Linux track every connection).
Redis 1.1 KB The subscription : its key, its place in the list of its condition, and the channel API Maker listens on.
In all 8.7 KB 120,250 clients per GB of memory.

Measured over the levels at which nothing was in the swap. The memory the whole server had available went down by 7.8 KB per client : MongoDB, the sandboxes and the cache of files give some back while the clients take theirs.

One more subscription, and a broadcast to everybody

With 100,000 clients connected, every client sent a second REGISTER, for an event without a condition (announcements), 4,000 of them a second : 100,000 were taken in 25.0 s. They waited 30 seconds with two subscriptions each, were told 3 broadcasts, one call of the emit event WS API each, and took the subscription back with UNREGISTER.

One subscription more 1.2KB per client : API Maker 0.5 KB · Redis 0.8 KB
A broadcast to 100k clients 1.09s until the last client read it
Half of them told after 706ms the first after 358 ms
Clients told / second 91,869 one call, every client
Broadcast Clients told The call answered after The first client Half of them 99 % of them The last one Clients told a second
1 100,000 of 100,000 1.09 s 358 ms 706 ms 1,079 ms 1,089 ms 91,869
2 100,000 of 100,000 1.25 s 358 ms 796 ms 1,243 ms 1,253 ms 79,784
3 100,000 of 100,000 1.20 s 323 ms 781 ms 1,184 ms 1,195 ms 83,681

One call of the emit event WS API tells every client : API Maker asks Redis for the clients of the event, publishes the notification for each of them, and the server which holds a client sends it. The times are counted from the moment the call is written to the moment a client reads its notification.

Memory, 100,000 clients One subscription each Two subscriptions each A subscription more, per client
API Maker 437 MB 484 MB 0.5 KB
Redis (its data) 103 MB 175 MB 0.8 KB
Keys of Redis · channels 200,016 · 100,005 300,017 · 200,005
Whole server, less available 1.2 KB

New clients per second

How many clients a second the server lets in : 100 clients at a time connect, are let in and leave, one after the other, for 60 seconds (after 5 seconds which are not counted). It is what a server faces when its clients all come back, after a deployment or a network cut. The times are counted from the start of the TCP connection.

Connect : the token of the API user

A client connects with x-am-authorization alone, is told CONNECTED, and leaves. API Maker checks the token of the API user and finds its groups : what every WebSocket client costs before it asks for anything.

Clients / second 15,228 914,609 clients in 60 s, 100 at a time
Let in after, p50 3.89ms connected 3.89 ms · TCP 0.24 ms
Let in after, p99 7.84ms max 43.4 ms
Refused or lost 0 not connected, not subscribed, no answer

Server during this run API Maker 3.7 vCPU · MongoDB 0.0 vCPU · whole server busy 96 % · load generator busy 61 %

am_ws_load · Connect : the token of the API user · 60 s
$ am_ws_load churn -c 100 -d 60 "ws://<server>:38246/?x-am-authorization=<token>"
Running 60s test @ ws://<server>:38246
100 clients at a time : connect, CONNECTED, leave

┌─────────────┬─────────┬─────────┬──────────┬──────────┬─────────┬─────────┬──────────┐
│ Stat        │ 2.5%    │ 50%     │ 97.5%    │ 99%      │ Avg     │ Stdev   │ Max      │
├─────────────┼─────────┼─────────┼──────────┼──────────┼─────────┼─────────┼──────────┤
│ TCP connect │ 0.16 ms │ 0.24 ms │ 0.51 ms  │ 0.87 ms  │ 0.27 ms │ 0.28 ms │ 24.51 ms │
├─────────────┼─────────┼─────────┼──────────┼──────────┼─────────┼─────────┼──────────┤
│ CONNECTED   │ 1.38 ms │ 3.89 ms │ 6.92 ms  │ 7.84 ms  │ 3.94 ms │ 1.51 ms │ 43.42 ms │
├─────────────┼─────────┼─────────┼──────────┼──────────┼─────────┼─────────┼──────────┤
│ Left        │ 3.51 ms │ 6.38 ms │ 10.43 ms │ 11.63 ms │ 6.53 ms │ 1.87 ms │ 48.51 ms │
└─────────────┴─────────┴─────────┴──────────┴──────────┴─────────┴─────────┴──────────┘
┌─────────────┬───────┬────────┬────────┬────────┬──────────┬─────────┬───────┐
│ Stat        │ 1%    │ 2.5%   │ 50%    │ 97.5%  │ Avg      │ Stdev   │ Min   │
├─────────────┼───────┼────────┼────────┼────────┼──────────┼─────────┼───────┤
│ Clients/Sec │ 9,300 │ 12,263 │ 15,347 │ 16,567 │ 15,243.5 │ 1194.82 │ 9,300 │
└─────────────┴───────┴────────┴────────┴────────┴──────────┴─────────┴───────┘

Time from the start of the connection to each step. Clients counted once per second.
# of samples: 60

915k clients let in in 60.06s, 0 refused or lost

Connect : both tokens

A client connects with x-am-authorization and x-am-user-authorization, is told CONNECTED, and leaves. Both tokens are checked : the one of the API user, and the one of a person, made by the DB token generator of the account.

Clients / second 12,826 770,333 clients in 60 s, 100 at a time
Let in after, p50 4.63ms connected 4.63 ms · TCP 0.23 ms
Let in after, p99 9.04ms max 23.1 ms
Refused or lost 0 not connected, not subscribed, no answer

Server during this run API Maker 3.7 vCPU · MongoDB 0.0 vCPU · whole server busy 96 % · load generator busy 48 %

am_ws_load · Connect : both tokens · 60 s
$ am_ws_load churn -c 100 -d 60 "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
Running 60s test @ ws://<server>:38246
100 clients at a time : connect, CONNECTED, leave

┌─────────────┬─────────┬─────────┬──────────┬──────────┬─────────┬─────────┬──────────┐
│ Stat        │ 2.5%    │ 50%     │ 97.5%    │ 99%      │ Avg     │ Stdev   │ Max      │
├─────────────┼─────────┼─────────┼──────────┼──────────┼─────────┼─────────┼──────────┤
│ TCP connect │ 0.16 ms │ 0.23 ms │ 0.47 ms  │ 0.88 ms  │ 0.26 ms │ 0.23 ms │ 11.46 ms │
├─────────────┼─────────┼─────────┼──────────┼──────────┼─────────┼─────────┼──────────┤
│ CONNECTED   │ 1.56 ms │ 4.63 ms │ 8.2 ms   │ 9.04 ms  │ 4.66 ms │ 1.74 ms │ 23.15 ms │
├─────────────┼─────────┼─────────┼──────────┼──────────┼─────────┼─────────┼──────────┤
│ Left        │ 4.11 ms │ 7.62 ms │ 12.26 ms │ 13.36 ms │ 7.77 ms │ 2.12 ms │ 31.97 ms │
└─────────────┴─────────┴─────────┴──────────┴──────────┴─────────┴─────────┴──────────┘
┌─────────────┬───────┬────────┬────────┬────────┬──────────┬────────┬───────┐
│ Stat        │ 1%    │ 2.5%   │ 50%    │ 97.5%  │ Avg      │ Stdev  │ Min   │
├─────────────┼───────┼────────┼────────┼────────┼──────────┼────────┼───────┤
│ Clients/Sec │ 9,778 │ 11,855 │ 12,652 │ 14,414 │ 12,838.9 │ 797.52 │ 9,778 │
└─────────────┴───────┴────────┴────────┴────────┴──────────┴────────┴───────┘

Time from the start of the connection to each step. Clients counted once per second.
# of samples: 60

770k clients let in in 60.06s, 0 refused or lost

Connect with both tokens and subscribe

The whole of what an application does : connect with both tokens, CONNECTED, one REGISTER for a custom WebSocket event with a condition of its own (recipientId : its user id), the answer, then leave. API Maker checks the groups and the auth provider of the event, keeps the subscription in Redis and listens on its channel ; when the client leaves, all of it is taken back.

Clients / second 7,009 420,960 clients in 60 s, 100 at a time
Let in after, p50 12.5ms connected 2.97 ms · TCP 0.22 ms
Let in after, p99 18.9ms max 30.3 ms
Refused or lost 0 not connected, not subscribed, no answer

Server during this run API Maker 3.0 vCPU · Redis 0.3 vCPU · whole server busy 95 % · load generator busy 31 %

am_ws_load · Connect with both tokens and subscribe · 60 s
$ am_ws_load churn -c 100 -d 60 "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>" --register 'order-updates'
Running 60s test @ ws://<server>:38246
100 clients at a time : connect, CONNECTED, REGISTER, leave

┌─────────────┬─────────┬──────────┬──────────┬─────────┬──────────┬─────────┬──────────┐
│ Stat        │ 2.5%    │ 50%      │ 97.5%    │ 99%     │ Avg      │ Stdev   │ Max      │
├─────────────┼─────────┼──────────┼──────────┼─────────┼──────────┼─────────┼──────────┤
│ TCP connect │ 0.16 ms │ 0.22 ms  │ 0.38 ms  │ 0.46 ms │ 0.23 ms  │ 0.11 ms │ 12.13 ms │
├─────────────┼─────────┼──────────┼──────────┼─────────┼──────────┼─────────┼──────────┤
│ CONNECTED   │ 0.91 ms │ 2.97 ms  │ 6.11 ms  │ 6.8 ms  │ 3.11 ms  │ 1.37 ms │ 18.26 ms │
├─────────────┼─────────┼──────────┼──────────┼─────────┼──────────┼─────────┼──────────┤
│ REGISTER    │ 7.79 ms │ 12.53 ms │ 17.74 ms │ 18.9 ms │ 12.59 ms │ 2.5 ms  │ 30.26 ms │
├─────────────┼─────────┼──────────┼──────────┼─────────┼──────────┼─────────┼──────────┤
│ Left        │ 9.38 ms │ 14.1 ms  │ 19.86 ms │ 21.1 ms │ 14.24 ms │ 2.64 ms │ 32.99 ms │
└─────────────┴─────────┴──────────┴──────────┴─────────┴──────────┴─────────┴──────────┘
┌─────────────┬───────┬───────┬───────┬───────┬─────────┬────────┬───────┐
│ Stat        │ 1%    │ 2.5%  │ 50%   │ 97.5% │ Avg     │ Stdev  │ Min   │
├─────────────┼───────┼───────┼───────┼───────┼─────────┼────────┼───────┤
│ Clients/Sec │ 6,048 │ 6,353 │ 6,988 │ 7,985 │ 7,016.0 │ 440.19 │ 6,048 │
└─────────────┴───────┴───────┴───────┴───────┴─────────┴────────┴───────┘

Time from the start of the connection to each step. Clients counted once per second.
# of samples: 60

421k clients let in in 60.06s, 0 refused or lost

Subscribe to an event with a can user connect code

The same, on an event whose can user connect code decides who may subscribe : it reads the person of x-am-user-authorization from g.req.auth. The code ran in the server itself (lean code, QuickJS).

Clients / second 5,916 355,319 clients in 60 s, 100 at a time
Let in after, p50 14.9ms connected 3.34 ms · TCP 0.21 ms
Let in after, p99 22.5ms max 36.8 ms
Refused or lost 0 not connected, not subscribed, no answer

Server during this run API Maker 3.1 vCPU · Redis 0.3 vCPU · whole server busy 97 % · load generator busy 26 %

am_ws_load · Subscribe to an event with a can user connect code · 60 s
$ am_ws_load churn -c 100 -d 60 "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>" --register 'checked-token'
Running 60s test @ ws://<server>:38246
100 clients at a time : connect, CONNECTED, REGISTER, leave

┌─────────────┬──────────┬──────────┬──────────┬──────────┬──────────┬─────────┬──────────┐
│ Stat        │ 2.5%     │ 50%      │ 97.5%    │ 99%      │ Avg      │ Stdev   │ Max      │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ TCP connect │ 0.16 ms  │ 0.21 ms  │ 0.39 ms  │ 0.65 ms  │ 0.24 ms  │ 0.21 ms │ 10.03 ms │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ CONNECTED   │ 1.05 ms  │ 3.34 ms  │ 6.76 ms  │ 7.6 ms   │ 3.48 ms  │ 1.51 ms │ 19.09 ms │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ REGISTER    │ 9.36 ms  │ 14.89 ms │ 20.88 ms │ 22.48 ms │ 14.93 ms │ 2.91 ms │ 36.83 ms │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ Left        │ 11.23 ms │ 16.74 ms │ 23.36 ms │ 25.12 ms │ 16.88 ms │ 3.07 ms │ 43.01 ms │
└─────────────┴──────────┴──────────┴──────────┴──────────┴──────────┴─────────┴──────────┘
┌─────────────┬───────┬───────┬───────┬───────┬─────────┬────────┬───────┐
│ Stat        │ 1%    │ 2.5%  │ 50%   │ 97.5% │ Avg     │ Stdev  │ Min   │
├─────────────┼───────┼───────┼───────┼───────┼─────────┼────────┼───────┤
│ Clients/Sec │ 4,907 │ 5,040 │ 5,848 │ 6,689 │ 5,922.0 │ 390.79 │ 4,907 │
└─────────────┴───────┴───────┴───────┴───────┴─────────┴────────┴───────┘

Time from the start of the connection to each step. Clients counted once per second.
# of samples: 60

355k clients let in in 60.06s, 0 refused or lost

Subscribe : the code reads the database

The same, with a can user connect code which also reads the person from the database (g.sys.db.getAll with a find) before it answers : one read of MongoDB for every subscription. The code ran in a sandbox of the account.

Clients / second 2,735 164,297 clients in 60 s, 100 at a time
Let in after, p50 33.6ms connected 4.63 ms · TCP 0.21 ms
Let in after, p99 52.0ms max 83.5 ms
Refused or lost 0 not connected, not subscribed, no answer

Server during this run API Maker 1.4 vCPU · Redis 0.2 vCPU · MongoDB 0.7 vCPU · sandboxes 1.4 vCPU · whole server busy 99 % · load generator busy 11 %

am_ws_load · Subscribe : the code reads the database · 60 s
$ am_ws_load churn -c 100 -d 60 "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>" --register 'checked-database'
Running 60s test @ ws://<server>:38246
100 clients at a time : connect, CONNECTED, REGISTER, leave

┌─────────────┬──────────┬──────────┬──────────┬──────────┬──────────┬─────────┬──────────┐
│ Stat        │ 2.5%     │ 50%      │ 97.5%    │ 99%      │ Avg      │ Stdev   │ Max      │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ TCP connect │ 0.16 ms  │ 0.21 ms  │ 0.37 ms  │ 0.42 ms  │ 0.22 ms  │ 0.06 ms │ 4.6 ms   │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ CONNECTED   │ 1.45 ms  │ 4.63 ms  │ 9.85 ms  │ 11.06 ms │ 4.89 ms  │ 2.18 ms │ 20.78 ms │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ REGISTER    │ 21.47 ms │ 33.63 ms │ 48.7 ms  │ 52.03 ms │ 34.01 ms │ 6.96 ms │ 83.52 ms │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ Left        │ 23.74 ms │ 36.16 ms │ 51.65 ms │ 55.04 ms │ 36.53 ms │ 7.12 ms │ 88.77 ms │
└─────────────┴──────────┴──────────┴──────────┴──────────┴──────────┴─────────┴──────────┘
┌─────────────┬───────┬───────┬───────┬───────┬─────────┬────────┬───────┐
│ Stat        │ 1%    │ 2.5%  │ 50%   │ 97.5% │ Avg     │ Stdev  │ Min   │
├─────────────┼───────┼───────┼───────┼───────┼─────────┼────────┼───────┤
│ Clients/Sec │ 2,404 │ 2,565 │ 2,701 │ 3,152 │ 2,738.3 │ 148.15 │ 2,404 │
└─────────────┴───────┴───────┴───────┴───────┴─────────┴────────┴───────┘

Time from the start of the connection to each step. Clients counted once per second.
# of samples: 60

164k clients let in in 60.06s, 0 refused or lost

Subscribe : the code reads the clock

The same, with a can user connect code which reads the time of the machine (Date.now()) : code which is not lean, so API Maker runs it in a sandbox of the account. The code ran in a sandbox of the account.

Clients / second 5,243 314,867 clients in 60 s, 100 at a time
Let in after, p50 17.2ms connected 3.03 ms · TCP 0.21 ms
Let in after, p99 26.5ms max 44.0 ms
Refused or lost 0 not connected, not subscribed, no answer

Server during this run API Maker 2.6 vCPU · Redis 0.3 vCPU · sandboxes 0.6 vCPU · whole server busy 97 % · load generator busy 23 %

am_ws_load · Subscribe : the code reads the clock · 60 s
$ am_ws_load churn -c 100 -d 60 "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>" --register 'checked-sandbox'
Running 60s test @ ws://<server>:38246
100 clients at a time : connect, CONNECTED, REGISTER, leave

┌─────────────┬──────────┬──────────┬──────────┬──────────┬──────────┬─────────┬──────────┐
│ Stat        │ 2.5%     │ 50%      │ 97.5%    │ 99%      │ Avg      │ Stdev   │ Max      │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ TCP connect │ 0.16 ms  │ 0.21 ms  │ 0.38 ms  │ 0.46 ms  │ 0.23 ms  │ 0.15 ms │ 9.84 ms  │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ CONNECTED   │ 1.05 ms  │ 3.03 ms  │ 6.05 ms  │ 6.8 ms   │ 3.16 ms  │ 1.31 ms │ 20.16 ms │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ REGISTER    │ 10.99 ms │ 17.18 ms │ 24.72 ms │ 26.51 ms │ 17.34 ms │ 3.45 ms │ 43.97 ms │
├─────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ Left        │ 12.67 ms │ 18.83 ms │ 26.7 ms  │ 28.58 ms │ 19.05 ms │ 3.56 ms │ 47.26 ms │
└─────────────┴──────────┴──────────┴──────────┴──────────┴──────────┴─────────┴──────────┘
┌─────────────┬───────┬───────┬───────┬───────┬─────────┬────────┬───────┐
│ Stat        │ 1%    │ 2.5%  │ 50%   │ 97.5% │ Avg     │ Stdev  │ Min   │
├─────────────┼───────┼───────┼───────┼───────┼─────────┼────────┼───────┤
│ Clients/Sec │ 4,310 │ 4,498 │ 5,231 │ 5,553 │ 5,247.8 │ 222.86 │ 4,310 │
└─────────────┴───────┴───────┴───────┴───────┴─────────┴────────┴───────┘

Time from the start of the connection to each step. Clients counted once per second.
# of samples: 60

315k clients let in in 60.06s, 0 refused or lost

Can user connect code

An event of the WebSocket Events page can carry a can user connect code : API Maker runs it for every subscription to the event, with the tokens of the client in g.req.auth and the subscription in g.req.eventData, and lets the client subscribe when it returns { canConnect: true }. Three codes were measured : one which reads the person of the token, one which also reads the database, one which reads the clock.

Can user connect code of the event checked-token : ran in the server
import * as T from 'types';

async function main(g: T.IAMGlobal) {
    // The person of x-am-user-authorization : only somebody who signed in subscribes, from a country we serve.
    const person = g.req.auth.authAMDB;
    if (!person) return { canConnect: false, errorText: 'Sign in first.' };
    return { canConnect: person.country === 'India', errorText: 'Not available in your country.' };
};
module.exports = main;
Can user connect code of the event checked-database : ran in the sandbox
import * as T from 'types';

async function main(g: T.IAMGlobal) {
    const person = g.req.auth.authAMDB;
    if (!person) return { canConnect: false, errorText: 'Sign in first.' };
    // Still a customer ? One read of the database for every subscription.
    const rows = await g.sys.db.getAll({ instance: 'mongodb', database: 'am_bench', collection: 'customers', queryParams: { find: { customer_id: person.customer_id } } });
    return { canConnect: rows.length === 1 && rows[0].country === 'India', errorText: 'Not a customer any more.' };
};
module.exports = main;
Can user connect code of the event checked-sandbox : ran in the sandbox
import * as T from 'types';

async function main(g: T.IAMGlobal) {
    const person = g.req.auth.authAMDB;
    if (!person) return { canConnect: false, errorText: 'Sign in first.' };
    // The time of the machine : this code runs in the sandbox of the account.
    const hour = new Date(Date.now()).getUTCHours();
    return { canConnect: person.country === 'India' && hour >= 0, errorText: 'Not available in your country.' };
};
module.exports = main;
Can user connect code Runs in Clients / second Subscribed after, p50 p99 Against no code
No code – 7,009 12.5 ms 18.9 ms –
Reads the person of the token the server (QuickJS) 5,916 14.9 ms 22.5 ms 16 % fewer
Reads the person from the database a sandbox of the account 2,735 33.6 ms 52.0 ms 61 % fewer
Reads the clock a sandbox of the account 5,243 17.2 ms 26.5 ms 25 % fewer

Lean code (it only reads what it is handed) runs in the server itself, with QuickJS, on the thread which serves the client. Code which needs more runs in a sandbox of the account : every subscription is then a round trip to the sandbox.

Notifications

With 10,000 clients connected, autocannon makes the HTTP calls which notify them, for 60 seconds, and the clients count what they receive and how late. Each kind of notification is measured twice : at a pace far under what the server takes, which shows how long a notification takes, and with no pace, which shows how many a second the server tells. Delivery is the time from the moment autocannon writes the request to the moment the client reads the notification : the HTTP call, API Maker, Redis, and the WebSocket.

A notification for one person

autocannon calls the emit event WS API with both tokens ; every call names another one of the 10,000 connected clients (recipientId), which is the only one told. The clients measure how long each notification took from the moment its request was written.

Calls / second (paced) 1,000 60,003 calls in 60 s, 10 connections
Notifications / second 983 60,013 received by 10,000 clients
Delivery p50 1.06ms average 1.11 ms
Delivery p99 2.03ms max 8.62 ms
Not delivered 0 0 calls failed

Server during this run API Maker 0.3 vCPU · Redis 0.0 vCPU · whole server busy 10 % · load generator busy 6 %

autocannon · A notification for one person, 1,000 a second

$ autocannon -c 10 -d 60 -R 1000 -l -m POST -b '{"name":"order-updates","eventData":{"recipientId":"<id of a client>","t":<now>,"type":"order-updated","order_no":1001,"status":"SHIPPED"}}' -H "x-am-authorization: <token>" -H "x-am-user-authorization: <token>" -H "content-type: application/json" "http://<server>:38246/api/system-api/bench/emit-event-ws"
Running 60s test @ http://<server>:38246/api/system-api/bench/emit-event-ws
10 connections

┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬──────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%  │ Avg     │ Stdev   │ Max  │
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼──────┤
│ Latency │ 0 ms │ 1 ms │ 2 ms  │ 2 ms │ 0.84 ms │ 0.48 ms │ 8 ms │
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴──────┘
┌───────────┬────────┬────────┬────────┬────────┬──────────┬───────┬────────┐
│ Stat      │ 1%     │ 2.5%   │ 50%    │ 97.5%  │ Avg      │ Stdev │ Min    │
├───────────┼────────┼────────┼────────┼────────┼──────────┼───────┼────────┤
│ Req/Sec   │ 997    │ 997    │ 1,000  │ 1,002  │ 1,000.05 │ 1.09  │ 997    │
├───────────┼────────┼────────┼────────┼────────┼──────────┼───────┼────────┤
│ Bytes/Sec │ 356 kB │ 356 kB │ 357 kB │ 358 kB │ 357 kB   │ 383 B │ 356 kB │
└───────────┴────────┴────────┴────────┴────────┴──────────┴───────┴────────┘

Req/Bytes counts sampled once per second.
# of samples: 60

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 0            │
├────────────┼──────────────┤
│ 0.01       │ 0            │
├────────────┼──────────────┤
│ 0.1        │ 0            │
├────────────┼──────────────┤
│ 1          │ 0            │
├────────────┼──────────────┤
│ 2.5        │ 0            │
├────────────┼──────────────┤
│ 10         │ 0            │
├────────────┼──────────────┤
│ 25         │ 1            │
├────────────┼──────────────┤
│ 50         │ 1            │
├────────────┼──────────────┤
│ 75         │ 1            │
├────────────┼──────────────┤
│ 90         │ 1            │
├────────────┼──────────────┤
│ 97.5       │ 2            │
├────────────┼──────────────┤
│ 99         │ 2            │
├────────────┼──────────────┤
│ 99.9       │ 4            │
├────────────┼──────────────┤
│ 99.99      │ 6            │
├────────────┼──────────────┤
│ 99.999     │ 8            │
└────────────┴──────────────┘

61k requests in 60.04s, 21.4 MB read

am_ws_load · what the clients received

$ am_ws_load listen "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
10,000 clients subscribed, 64.05s

┌──────────┬─────────┬─────────┬────────┬─────────┬─────────┬─────────┬─────────┐
│ Stat     │ 2.5%    │ 50%     │ 97.5%  │ 99%     │ Avg     │ Stdev   │ Max     │
├──────────┼─────────┼─────────┼────────┼─────────┼─────────┼─────────┼─────────┤
│ Delivery │ 0.67 ms │ 1.06 ms │ 1.8 ms │ 2.03 ms │ 1.11 ms │ 0.32 ms │ 8.62 ms │
└──────────┴─────────┴─────────┴────────┴─────────┴─────────┴─────────┴─────────┘
┌───────────┬────┬──────┬───────┬───────┬───────┬────────┬─────┐
│ Stat      │ 1% │ 2.5% │ 50%   │ 97.5% │ Avg   │ Stdev  │ Min │
├───────────┼────┼──────┼───────┼───────┼───────┼────────┼─────┤
│ Notif/Sec │ 0  │ 0    │ 1,000 │ 1,000 │ 951.8 │ 213.66 │ 0   │
└───────────┴────┴──────┴───────┴───────┴───────┴────────┴─────┘

Delivery : from the moment the request is written to the moment the client reads the notification.
# of samples: 64

60k notifications received in 64.05s (60,013 of 60,003 expected), 10.7 MB read

Calls / second 13,711 822,630 calls in 60 s, 100 connections
Notifications / second 13,441 822,727 received by 10,000 clients
Delivery p50 7.07ms average 7.12 ms
Delivery p99 10.9ms max 22.1 ms
Not delivered 0 0 calls failed

Server during this run API Maker 3.4 vCPU · Redis 0.2 vCPU · whole server busy 96 % · load generator busy 31 %

autocannon · A notification for one person, as many as the server takes

$ autocannon -c 100 -d 60 -w 5 -l -m POST -b '{"name":"order-updates","eventData":{"recipientId":"<id of a client>","t":<now>,"type":"order-updated","order_no":1001,"status":"SHIPPED"}}' -H "x-am-authorization: <token>" -H "x-am-user-authorization: <token>" -H "content-type: application/json" "http://<server>:38246/api/system-api/bench/emit-event-ws"
Running 60s test @ http://<server>:38246/api/system-api/bench/emit-event-ws
100 connections
5 workers

┌─────────┬──────┬──────┬───────┬───────┬─────────┬─────────┬───────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%   │ Avg     │ Stdev   │ Max   │
├─────────┼──────┼──────┼───────┼───────┼─────────┼─────────┼───────┤
│ Latency │ 4 ms │ 7 ms │ 10 ms │ 11 ms │ 6.76 ms │ 1.47 ms │ 26 ms │
└─────────┴──────┴──────┴───────┴───────┴─────────┴─────────┴───────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬───────────┬────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg       │ Stdev  │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼────────┼─────────┤
│ Req/Sec   │ 11,431  │ 13,071  │ 13,767  │ 14,607  │ 13,710.67 │ 471.67 │ 11,431  │
├───────────┼─────────┼─────────┼─────────┼─────────┼───────────┼────────┼─────────┤
│ Bytes/Sec │ 4.08 MB │ 4.67 MB │ 4.92 MB │ 5.22 MB │ 4.89 MB   │ 168 kB │ 4.08 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴───────────┴────────┴─────────┘

Req/Bytes counts sampled once per second.
# of samples: 300

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 1            │
├────────────┼──────────────┤
│ 0.01       │ 2            │
├────────────┼──────────────┤
│ 0.1        │ 3            │
├────────────┼──────────────┤
│ 1          │ 4            │
├────────────┼──────────────┤
│ 2.5        │ 4            │
├────────────┼──────────────┤
│ 10         │ 5            │
├────────────┼──────────────┤
│ 25         │ 6            │
├────────────┼──────────────┤
│ 50         │ 7            │
├────────────┼──────────────┤
│ 75         │ 8            │
├────────────┼──────────────┤
│ 90         │ 9            │
├────────────┼──────────────┤
│ 97.5       │ 10           │
├────────────┼──────────────┤
│ 99         │ 11           │
├────────────┼──────────────┤
│ 99.9       │ 13           │
├────────────┼──────────────┤
│ 99.99      │ 17           │
├────────────┼──────────────┤
│ 99.999     │ 22           │
└────────────┴──────────────┘

823k requests in 60.02s, 294 MB read

am_ws_load · what the clients received

$ am_ws_load listen "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
10,000 clients subscribed, 64.22s

┌──────────┬─────────┬─────────┬──────────┬──────────┬─────────┬─────────┬──────────┐
│ Stat     │ 2.5%    │ 50%     │ 97.5%    │ 99%      │ Avg     │ Stdev   │ Max      │
├──────────┼─────────┼─────────┼──────────┼──────────┼─────────┼─────────┼──────────┤
│ Delivery │ 4.44 ms │ 7.07 ms │ 10.14 ms │ 10.91 ms │ 7.12 ms │ 1.43 ms │ 22.11 ms │
└──────────┴─────────┴─────────┴──────────┴──────────┴─────────┴─────────┴──────────┘
┌───────────┬────┬──────┬────────┬────────┬──────────┬─────────┬─────┐
│ Stat      │ 1% │ 2.5% │ 50%    │ 97.5%  │ Avg      │ Stdev   │ Min │
├───────────┼────┼──────┼────────┼────────┼──────────┼─────────┼─────┤
│ Notif/Sec │ 0  │ 0    │ 13,766 │ 14,522 │ 13,100.1 │ 2759.19 │ 0   │
└───────────┴────┴──────┴────────┴────────┴──────────┴─────────┴─────┘

Delivery : from the moment the request is written to the moment the client reads the notification.
# of samples: 64

823k notifications received in 64.22s (822,727 of 822,630 expected), 147.3 MB read

A broadcast

1,000 more clients subscribe to an event without a condition : every call of the emit event WS API reaches all 1,000 of them.

Calls / second (paced) 5 300 calls in 60 s, 1 connection
Notifications / second 4,997 300,000 received by 1,000 clients
Delivery p50 7.56ms average 8.06 ms
Delivery p99 16.4ms max 23.2 ms
Not delivered 0 0 calls failed

Server during this run API Maker 0.1 vCPU · Redis 0.0 vCPU · whole server busy 4 % · load generator busy 5 %

autocannon · A broadcast to 1,000 clients, 5 a second

$ autocannon -c 1 -d 60 -R 5 -l -m POST -b '{"name":"announcements","eventData":{"t":<now>,"type":"announcement","text":"Hello from API Maker"}}' -H "x-am-authorization: <token>" -H "x-am-user-authorization: <token>" -H "content-type: application/json" "http://<server>:38246/api/system-api/bench/emit-event-ws"
Running 60s test @ http://<server>:38246/api/system-api/bench/emit-event-ws
1 connections

┌─────────┬──────┬──────┬───────┬───────┬─────────┬─────────┬───────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%   │ Avg     │ Stdev   │ Max   │
├─────────┼──────┼──────┼───────┼───────┼─────────┼─────────┼───────┤
│ Latency │ 1 ms │ 7 ms │ 16 ms │ 17 ms │ 7.57 ms │ 4.31 ms │ 23 ms │
└─────────┴──────┴──────┴───────┴───────┴─────────┴─────────┴───────┘
┌───────────┬────────┬────────┬────────┬────────┬────────┬───────┬────────┐
│ Stat      │ 1%     │ 2.5%   │ 50%    │ 97.5%  │ Avg    │ Stdev │ Min    │
├───────────┼────────┼────────┼────────┼────────┼────────┼───────┼────────┤
│ Req/Sec   │ 5      │ 5      │ 5      │ 5      │ 5      │ 0     │ 5      │
├───────────┼────────┼────────┼────────┼────────┼────────┼───────┼────────┤
│ Bytes/Sec │ 1.8 kB │ 1.8 kB │ 1.8 kB │ 1.8 kB │ 1.8 kB │ 0 B   │ 1.8 kB │
└───────────┴────────┴────────┴────────┴────────┴────────┴───────┴────────┘

Req/Bytes counts sampled once per second.
# of samples: 60

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 1            │
├────────────┼──────────────┤
│ 0.01       │ 1            │
├────────────┼──────────────┤
│ 0.1        │ 1            │
├────────────┼──────────────┤
│ 1          │ 1            │
├────────────┼──────────────┤
│ 2.5        │ 1            │
├────────────┼──────────────┤
│ 10         │ 2            │
├────────────┼──────────────┤
│ 25         │ 4            │
├────────────┼──────────────┤
│ 50         │ 7            │
├────────────┼──────────────┤
│ 75         │ 11           │
├────────────┼──────────────┤
│ 90         │ 13           │
├────────────┼──────────────┤
│ 97.5       │ 16           │
├────────────┼──────────────┤
│ 99         │ 17           │
├────────────┼──────────────┤
│ 99.9       │ 21           │
├────────────┼──────────────┤
│ 99.99      │ 23           │
├────────────┼──────────────┤
│ 99.999     │ 23           │
└────────────┴──────────────┘

305 requests in 60.03s, 108 kB read

am_ws_load · what the clients received

$ am_ws_load listen "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
1,000 clients subscribed, 63.04s

┌──────────┬─────────┬─────────┬──────────┬─────────┬─────────┬───────┬──────────┐
│ Stat     │ 2.5%    │ 50%     │ 97.5%    │ 99%     │ Avg     │ Stdev │ Max      │
├──────────┼─────────┼─────────┼──────────┼─────────┼─────────┼───────┼──────────┤
│ Delivery │ 3.78 ms │ 7.56 ms │ 15.03 ms │ 16.4 ms │ 8.06 ms │ 3 ms  │ 23.18 ms │
└──────────┴─────────┴─────────┴──────────┴─────────┴─────────┴───────┴──────────┘
┌───────────┬────┬──────┬───────┬───────┬─────────┬────────┬─────┐
│ Stat      │ 1% │ 2.5% │ 50%   │ 97.5% │ Avg     │ Stdev  │ Min │
├───────────┼────┼──────┼───────┼───────┼─────────┼────────┼─────┤
│ Notif/Sec │ 0  │ 0    │ 5,000 │ 5,000 │ 4,836.1 │ 890.39 │ 0   │
└───────────┴────┴──────┴───────┴───────┴─────────┴────────┴─────┘

Delivery : from the moment the request is written to the moment the client reads the notification.
# of samples: 63

300k notifications received in 63.04s (300,000 of 300,000 expected), 46.0 MB read

Calls / second 150 8,977 calls in 60 s, 10 connections
Notifications / second 147,974 8,985,000 received by 1,000 clients
Delivery p50 58.5ms average 58.5 ms
Delivery p99 93.6ms max 134 ms
Not delivered 0 0 calls failed

Server during this run API Maker 3.4 vCPU · Redis 0.2 vCPU · whole server busy 94 % · load generator busy 47 %

autocannon · A broadcast to 1,000 clients, as many as the server takes

$ autocannon -c 10 -d 60 -w 5 -l -m POST -b '{"name":"announcements","eventData":{"t":<now>,"type":"announcement","text":"Hello from API Maker"}}' -H "x-am-authorization: <token>" -H "x-am-user-authorization: <token>" -H "content-type: application/json" "http://<server>:38246/api/system-api/bench/emit-event-ws"
Running 60s test @ http://<server>:38246/api/system-api/bench/emit-event-ws
10 connections
5 workers

┌─────────┬───────┬───────┬───────┬────────┬──────────┬──────────┬────────┐
│ Stat    │ 2.5%  │ 50%   │ 97.5% │ 99%    │ Avg      │ Stdev    │ Max    │
├─────────┼───────┼───────┼───────┼────────┼──────────┼──────────┼────────┤
│ Latency │ 41 ms │ 66 ms │ 94 ms │ 101 ms │ 66.24 ms │ 12.82 ms │ 133 ms │
└─────────┴───────┴───────┴───────┴────────┴──────────┴──────────┴────────┘
┌───────────┬───────┬───────┬─────────┬─────────┬─────────┬─────────┬───────┐
│ Stat      │ 1%    │ 2.5%  │ 50%     │ 97.5%   │ Avg     │ Stdev   │ Min   │
├───────────┼───────┼───────┼─────────┼─────────┼─────────┼─────────┼───────┤
│ Req/Sec   │ 136   │ 136   │ 149     │ 162     │ 149.62  │ 7.18    │ 136   │
├───────────┼───────┼───────┼─────────┼─────────┼─────────┼─────────┼───────┤
│ Bytes/Sec │ 49 kB │ 49 kB │ 53.7 kB │ 58.3 kB │ 53.9 kB │ 2.58 kB │ 49 kB │
└───────────┴───────┴───────┴─────────┴─────────┴─────────┴─────────┴───────┘

Req/Bytes counts sampled once per second.
# of samples: 300

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 21           │
├────────────┼──────────────┤
│ 0.01       │ 21           │
├────────────┼──────────────┤
│ 0.1        │ 25           │
├────────────┼──────────────┤
│ 1          │ 36           │
├────────────┼──────────────┤
│ 2.5        │ 41           │
├────────────┼──────────────┤
│ 10         │ 51           │
├────────────┼──────────────┤
│ 25         │ 59           │
├────────────┼──────────────┤
│ 50         │ 66           │
├────────────┼──────────────┤
│ 75         │ 73           │
├────────────┼──────────────┤
│ 90         │ 82           │
├────────────┼──────────────┤
│ 97.5       │ 94           │
├────────────┼──────────────┤
│ 99         │ 101          │
├────────────┼──────────────┤
│ 99.9       │ 117          │
├────────────┼──────────────┤
│ 99.99      │ 133          │
├────────────┼──────────────┤
│ 99.999     │ 133          │
└────────────┴──────────────┘

9k requests in 60.02s, 3.23 MB read

am_ws_load · what the clients received

$ am_ws_load listen "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
1,000 clients subscribed, 63.72s

┌──────────┬──────────┬─────────┬──────────┬──────────┬─────────┬──────────┬───────────┐
│ Stat     │ 2.5%     │ 50%     │ 97.5%    │ 99%      │ Avg     │ Stdev    │ Max       │
├──────────┼──────────┼─────────┼──────────┼──────────┼─────────┼──────────┼───────────┤
│ Delivery │ 31.55 ms │ 58.5 ms │ 86.46 ms │ 93.57 ms │ 58.5 ms │ 13.25 ms │ 133.76 ms │
└──────────┴──────────┴─────────┴──────────┴──────────┴─────────┴──────────┴───────────┘
┌───────────┬────┬──────┬─────────┬─────────┬───────────┬──────────┬─────┐
│ Stat      │ 1% │ 2.5% │ 50%     │ 97.5%   │ Avg       │ Stdev    │ Min │
├───────────┼────┼──────┼─────────┼─────────┼───────────┼──────────┼─────┤
│ Notif/Sec │ 0  │ 0    │ 148,920 │ 169,436 │ 143,677.4 │ 28365.51 │ 0   │
└───────────┴────┴──────┴─────────┴─────────┴───────────┴──────────┴─────┘

Delivery : from the moment the request is written to the moment the client reads the notification.
# of samples: 64

8.98M notifications received in 63.72s (8,985,000 of 8,977,000 expected), 1378.6 MB read

Rows inserted in a table

100 clients subscribe to the insert API of a table (SCHEMA_POST_BULK_INSERT on inserts_public, getEventData: true) ; autocannon inserts rows of the dataset through the insert API, and every row saved is told to each of the 100 clients, with its columns.

Calls / second (paced) 50 3,002 calls in 60 s, 10 connections
Notifications / second 4,933 301,100 received by 100 clients
Delivery p50 18.1ms average 18.1 ms
Delivery p99 30.0ms max 39.1 ms
Not delivered 0 0 calls failed

Server during this run API Maker 0.2 vCPU · Redis 0.0 vCPU · MongoDB 0.0 vCPU · whole server busy 6 % · load generator busy 5 %

autocannon · Inserts told to 100 clients, 50 inserts a second

$ autocannon -c 10 -d 60 -R 50 -l -m POST -b '{"customer_id":1,"first_name":"BENCH","last_name":"INSERT","phone":<now>,"last_update":"2006-02-15T04:34:00.330Z","pincode":111111,"shipping_id":2,"dob":"2022-10-30T03:25:03.000Z","country":"India"}' -H "content-type: application/json" "http://<server>:38246/api/schema/bench/mongodb/am_bench/inserts_public/save-single-or-multiple"
Running 60s test @ http://<server>:38246/api/schema/bench/mongodb/am_bench/inserts_public/save-single-or-multiple
10 connections

┌─────────┬──────┬──────┬───────┬───────┬─────────┬─────────┬───────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%   │ Avg     │ Stdev   │ Max   │
├─────────┼──────┼──────┼───────┼───────┼─────────┼─────────┼───────┤
│ Latency │ 1 ms │ 5 ms │ 15 ms │ 17 ms │ 6.14 ms │ 3.94 ms │ 30 ms │
└─────────┴──────┴──────┴───────┴───────┴─────────┴─────────┴───────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg     │ Stdev   │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Req/Sec   │ 45      │ 45      │ 50      │ 56      │ 50.04   │ 1.97    │ 45      │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 27.2 kB │ 27.2 kB │ 30.3 kB │ 33.9 kB │ 30.3 kB │ 1.19 kB │ 27.2 kB │
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘

Req/Bytes counts sampled once per second.
# of samples: 60

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 1            │
├────────────┼──────────────┤
│ 0.01       │ 1            │
├────────────┼──────────────┤
│ 0.1        │ 1            │
├────────────┼──────────────┤
│ 1          │ 1            │
├────────────┼──────────────┤
│ 2.5        │ 1            │
├────────────┼──────────────┤
│ 10         │ 1            │
├────────────┼──────────────┤
│ 25         │ 3            │
├────────────┼──────────────┤
│ 50         │ 5            │
├────────────┼──────────────┤
│ 75         │ 9            │
├────────────┼──────────────┤
│ 90         │ 12           │
├────────────┼──────────────┤
│ 97.5       │ 15           │
├────────────┼──────────────┤
│ 99         │ 17           │
├────────────┼──────────────┤
│ 99.9       │ 21           │
├────────────┼──────────────┤
│ 99.99      │ 28           │
├────────────┼──────────────┤
│ 99.999     │ 30           │
└────────────┴──────────────┘

3k requests in 60.03s, 1.82 MB read

am_ws_load · what the clients received

$ am_ws_load listen "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
100 clients subscribed, 64.05s

┌──────────┬─────────┬──────────┬──────────┬──────────┬──────────┬─────────┬──────────┐
│ Stat     │ 2.5%    │ 50%      │ 97.5%    │ 99%      │ Avg      │ Stdev   │ Max      │
├──────────┼─────────┼──────────┼──────────┼──────────┼──────────┼─────────┼──────────┤
│ Delivery │ 7.84 ms │ 18.08 ms │ 28.05 ms │ 30.02 ms │ 18.13 ms │ 5.05 ms │ 39.14 ms │
└──────────┴─────────┴──────────┴──────────┴──────────┴──────────┴─────────┴──────────┘
┌───────────┬────┬──────┬───────┬───────┬─────────┬─────────┬─────┐
│ Stat      │ 1% │ 2.5% │ 50%   │ 97.5% │ Avg     │ Stdev   │ Min │
├───────────┼────┼──────┼───────┼───────┼─────────┼─────────┼─────┤
│ Notif/Sec │ 0  │ 0    │ 5,000 │ 5,000 │ 4,775.8 │ 1000.76 │ 0   │
└───────────┴────┴──────┴───────┴───────┴─────────┴─────────┴─────┘

Delivery : from the moment the request is written to the moment the client reads the notification.
# of samples: 64

301k notifications received in 64.05s (301,100 of 300,200 expected), 94.4 MB read

Calls / second 932 55,919 calls in 60 s, 100 connections
Notifications / second 92,279 5,601,600 received by 100 clients
Delivery p50 370ms average 370 ms
Delivery p99 448ms max 518 ms
Not delivered 0 0 calls failed

Server during this run API Maker 2.7 vCPU · Redis 0.1 vCPU · MongoDB 0.6 vCPU · whole server busy 95 % · load generator busy 37 %

autocannon · Inserts told to 100 clients, as many as the server takes

$ autocannon -c 100 -d 60 -w 5 -l -m POST -b '{"customer_id":1,"first_name":"BENCH","last_name":"INSERT","phone":<now>,"last_update":"2006-02-15T04:34:00.330Z","pincode":111111,"shipping_id":2,"dob":"2022-10-30T03:25:03.000Z","country":"India"}' -H "content-type: application/json" "http://<server>:38246/api/schema/bench/mongodb/am_bench/inserts_public/save-single-or-multiple"
Running 60s test @ http://<server>:38246/api/schema/bench/mongodb/am_bench/inserts_public/save-single-or-multiple
100 connections
5 workers

┌─────────┬───────┬────────┬────────┬────────┬───────────┬──────────┬────────┐
│ Stat    │ 2.5%  │ 50%    │ 97.5%  │ 99%    │ Avg       │ Stdev    │ Max    │
├─────────┼───────┼────────┼────────┼────────┼───────────┼──────────┼────────┤
│ Latency │ 70 ms │ 106 ms │ 147 ms │ 158 ms │ 106.68 ms │ 19.24 ms │ 229 ms │
└─────────┴───────┴────────┴────────┴────────┴───────────┴──────────┴────────┘
┌───────────┬────────┬────────┬────────┬────────┬────────┬─────────┬────────┐
│ Stat      │ 1%     │ 2.5%   │ 50%    │ 97.5%  │ Avg    │ Stdev   │ Min    │
├───────────┼────────┼────────┼────────┼────────┼────────┼─────────┼────────┤
│ Req/Sec   │ 851    │ 856    │ 928    │ 1,004  │ 931.99 │ 45.19   │ 851    │
├───────────┼────────┼────────┼────────┼────────┼────────┼─────────┼────────┤
│ Bytes/Sec │ 515 kB │ 518 kB │ 562 kB │ 608 kB │ 564 kB │ 27.3 kB │ 515 kB │
└───────────┴────────┴────────┴────────┴────────┴────────┴─────────┴────────┘

Req/Bytes counts sampled once per second.
# of samples: 300

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 15           │
├────────────┼──────────────┤
│ 0.01       │ 20           │
├────────────┼──────────────┤
│ 0.1        │ 34           │
├────────────┼──────────────┤
│ 1          │ 60           │
├────────────┼──────────────┤
│ 2.5        │ 70           │
├────────────┼──────────────┤
│ 10         │ 84           │
├────────────┼──────────────┤
│ 25         │ 95           │
├────────────┼──────────────┤
│ 50         │ 106          │
├────────────┼──────────────┤
│ 75         │ 118          │
├────────────┼──────────────┤
│ 90         │ 130          │
├────────────┼──────────────┤
│ 97.5       │ 147          │
├────────────┼──────────────┤
│ 99         │ 158          │
├────────────┼──────────────┤
│ 99.9       │ 190          │
├────────────┼──────────────┤
│ 99.99      │ 213          │
├────────────┼──────────────┤
│ 99.999     │ 229          │
└────────────┴──────────────┘

56k requests in 60.03s, 33.8 MB read

am_ws_load · what the clients received

$ am_ws_load listen "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
100 clients subscribed, 63.71s

┌──────────┬──────────┬───────────┬───────────┬───────────┬───────────┬──────────┬──────────┐
│ Stat     │ 2.5%     │ 50%       │ 97.5%     │ 99%       │ Avg       │ Stdev    │ Max      │
├──────────┼──────────┼───────────┼───────────┼───────────┼───────────┼──────────┼──────────┤
│ Delivery │ 311.3 ms │ 369.66 ms │ 432.64 ms │ 447.74 ms │ 369.67 ms │ 32.95 ms │ 518.4 ms │
└──────────┴──────────┴───────────┴───────────┴───────────┴───────────┴──────────┴──────────┘
┌───────────┬────┬──────┬────────┬────────┬──────────┬──────────┬─────┐
│ Stat      │ 1% │ 2.5% │ 50%    │ 97.5%  │ Avg      │ Stdev    │ Min │
├───────────┼────┼──────┼────────┼────────┼──────────┼──────────┼─────┤
│ Notif/Sec │ 0  │ 0    │ 92,569 │ 98,851 │ 89,871.0 │ 16776.83 │ 0   │
└───────────┴────┴──────┴────────┴────────┴──────────┴──────────┴─────┘

Delivery : from the moment the request is written to the moment the client reads the notification.
# of samples: 64

5.60M notifications received in 63.71s (5,601,600 of 5,591,900 expected), 1756.9 MB read

With every client connected

The same runs once more, with 801,972 clients connected and waiting : what a server which is full of WebSocket clients still does.

No client, or 10,000 801,972 clients connected
A notification for one person, 1,000 a second : delivery p50 1.06 ms 1.22 ms
… p99 2.03 ms 2.44 ms
A notification for one person, as many as the server takes 13,441 / s 10,799 / s
Get all with both tokens, 100 connections (autocannon) 6,072 req/s 4,767 req/s
… latency p50 / p99 16 ms / 30 ms 18 ms / 105 ms

Calls / second (paced) 1,000 60,000 calls in 60 s, 10 connections
Notifications / second 983 60,010 received by 801,972 clients
Delivery p50 1.22ms average 1.27 ms
Delivery p99 2.44ms max 6.45 ms
Not delivered 0 0 calls failed

Server during this run API Maker 0.8 vCPU · Redis 0.0 vCPU · whole server busy 25 % · load generator busy 13 %

autocannon · A notification for one person, 1,000 a second, every client connected

$ autocannon -c 10 -d 60 -R 1000 -l -m POST -b '{"name":"order-updates","eventData":{"recipientId":"<id of a client>","t":<now>,"type":"order-updated","order_no":1001,"status":"SHIPPED"}}' -H "x-am-authorization: <token>" -H "x-am-user-authorization: <token>" -H "content-type: application/json" "http://<server>:38246/api/system-api/bench/emit-event-ws"
Running 60s test @ http://<server>:38246/api/system-api/bench/emit-event-ws
10 connections

┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬──────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%  │ Avg     │ Stdev   │ Max  │
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼──────┤
│ Latency │ 0 ms │ 1 ms │ 2 ms  │ 2 ms │ 0.97 ms │ 0.46 ms │ 6 ms │
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴──────┘
┌───────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐
│ Stat      │ 1%     │ 2.5%   │ 50%    │ 97.5%  │ Avg    │ Stdev  │ Min    │
├───────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
│ Req/Sec   │ 999    │ 999    │ 1,000  │ 1,001  │ 1,000  │ 0.26   │ 999    │
├───────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
│ Bytes/Sec │ 357 kB │ 357 kB │ 357 kB │ 357 kB │ 357 kB │ 66.1 B │ 357 kB │
└───────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘

Req/Bytes counts sampled once per second.
# of samples: 60

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 0            │
├────────────┼──────────────┤
│ 0.01       │ 0            │
├────────────┼──────────────┤
│ 0.1        │ 0            │
├────────────┼──────────────┤
│ 1          │ 0            │
├────────────┼──────────────┤
│ 2.5        │ 0            │
├────────────┼──────────────┤
│ 10         │ 0            │
├────────────┼──────────────┤
│ 25         │ 1            │
├────────────┼──────────────┤
│ 50         │ 1            │
├────────────┼──────────────┤
│ 75         │ 1            │
├────────────┼──────────────┤
│ 90         │ 1            │
├────────────┼──────────────┤
│ 97.5       │ 2            │
├────────────┼──────────────┤
│ 99         │ 2            │
├────────────┼──────────────┤
│ 99.9       │ 4            │
├────────────┼──────────────┤
│ 99.99      │ 5            │
├────────────┼──────────────┤
│ 99.999     │ 6            │
└────────────┴──────────────┘

61k requests in 60.02s, 21.4 MB read

am_ws_load · what the clients received

$ am_ws_load listen "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
801,972 clients subscribed, 64.03s

┌──────────┬────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ Stat     │ 2.5%   │ 50%     │ 97.5%   │ 99%     │ Avg     │ Stdev   │ Max     │
├──────────┼────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Delivery │ 0.7 ms │ 1.22 ms │ 2.14 ms │ 2.44 ms │ 1.27 ms │ 0.38 ms │ 6.45 ms │
└──────────┴────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘
┌───────────┬────┬──────┬───────┬───────┬───────┬────────┬─────┐
│ Stat      │ 1% │ 2.5% │ 50%   │ 97.5% │ Avg   │ Stdev  │ Min │
├───────────┼────┼──────┼───────┼───────┼───────┼────────┼─────┤
│ Notif/Sec │ 0  │ 0    │ 1,000 │ 1,000 │ 951.8 │ 213.87 │ 0   │
└───────────┴────┴──────┴───────┴───────┴───────┴────────┴─────┘

Delivery : from the moment the request is written to the moment the client reads the notification.
# of samples: 64

60k notifications received in 64.03s (60,010 of 60,000 expected), 10.8 MB read

Calls / second 10,925 655,468 calls in 60 s, 100 connections
Notifications / second 10,799 655,568 received by 801,972 clients
Delivery p50 7.66ms average 8.97 ms
Delivery p99 43.7ms max 173 ms
Not delivered 0 0 calls failed

Server during this run API Maker 3.4 vCPU · Redis 0.2 vCPU · whole server busy 97 % · load generator busy 41 %

autocannon · A notification for one person, as many as the server takes, every client connected

$ autocannon -c 100 -d 60 -w 5 -l -m POST -b '{"name":"order-updates","eventData":{"recipientId":"<id of a client>","t":<now>,"type":"order-updated","order_no":1001,"status":"SHIPPED"}}' -H "x-am-authorization: <token>" -H "x-am-user-authorization: <token>" -H "content-type: application/json" "http://<server>:38246/api/system-api/bench/emit-event-ws"
Running 60s test @ http://<server>:38246/api/system-api/bench/emit-event-ws
100 connections
5 workers

┌─────────┬──────┬──────┬───────┬───────┬─────────┬─────────┬────────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%   │ Avg     │ Stdev   │ Max    │
├─────────┼──────┼──────┼───────┼───────┼─────────┼─────────┼────────┤
│ Latency │ 4 ms │ 7 ms │ 26 ms │ 43 ms │ 8.62 ms │ 8.63 ms │ 173 ms │
└─────────┴──────┴──────┴───────┴───────┴─────────┴─────────┴────────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬──────────┬────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg      │ Stdev  │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼────────┼─────────┤
│ Req/Sec   │ 8,639   │ 8,927   │ 10,903  │ 12,279  │ 10,924.8 │ 669.48 │ 8,635   │
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼────────┼─────────┤
│ Bytes/Sec │ 3.08 MB │ 3.18 MB │ 3.89 MB │ 4.38 MB │ 3.9 MB   │ 239 kB │ 3.08 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴──────────┴────────┴─────────┘

Req/Bytes counts sampled once per second.
# of samples: 300

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 1            │
├────────────┼──────────────┤
│ 0.01       │ 1            │
├────────────┼──────────────┤
│ 0.1        │ 3            │
├────────────┼──────────────┤
│ 1          │ 4            │
├────────────┼──────────────┤
│ 2.5        │ 4            │
├────────────┼──────────────┤
│ 10         │ 5            │
├────────────┼──────────────┤
│ 25         │ 6            │
├────────────┼──────────────┤
│ 50         │ 7            │
├────────────┼──────────────┤
│ 75         │ 9            │
├────────────┼──────────────┤
│ 90         │ 10           │
├────────────┼──────────────┤
│ 97.5       │ 26           │
├────────────┼──────────────┤
│ 99         │ 43           │
├────────────┼──────────────┤
│ 99.9       │ 130          │
├────────────┼──────────────┤
│ 99.99      │ 161          │
├────────────┼──────────────┤
│ 99.999     │ 172          │
└────────────┴──────────────┘

656k requests in 60.02s, 234 MB read

am_ws_load · what the clients received

$ am_ws_load listen "ws://<server>:38246/?x-am-authorization=<token>&x-am-user-authorization=<token>"
801,972 clients subscribed, 63.71s

┌──────────┬─────────┬─────────┬──────────┬──────────┬─────────┬─────────┬───────────┐
│ Stat     │ 2.5%    │ 50%     │ 97.5%    │ 99%      │ Avg     │ Stdev   │ Max       │
├──────────┼─────────┼─────────┼──────────┼──────────┼─────────┼─────────┼───────────┤
│ Delivery │ 4.69 ms │ 7.66 ms │ 26.29 ms │ 43.68 ms │ 8.97 ms │ 8.56 ms │ 173.44 ms │
└──────────┴─────────┴─────────┴──────────┴──────────┴─────────┴─────────┴───────────┘
┌───────────┬────┬──────┬────────┬────────┬──────────┬─────────┬─────┐
│ Stat      │ 1% │ 2.5% │ 50%    │ 97.5%  │ Avg      │ Stdev   │ Min │
├───────────┼────┼──────┼────────┼────────┼──────────┼─────────┼─────┤
│ Notif/Sec │ 0  │ 0    │ 10,884 │ 11,952 │ 10,492.8 │ 2091.47 │ 0   │
└───────────┴────┴──────┴────────┴────────┴──────────┴─────────┴─────┘

Delivery : from the moment the request is written to the moment the client reads the notification.
# of samples: 64

656k notifications received in 63.71s (655,568 of 655,468 expected), 118.5 MB read

Requests / second 4,767 285,971 requests in 60 s
Latency p50 18ms average 20.48 ms
Latency p99 105ms max 296 ms
Errors 0 non-2xx, errors, timeouts

Server during this run API Maker 2.3 vCPU · Redis 0.2 vCPU · MongoDB 1.1 vCPU · whole server busy 99 % · load generator busy 23 %

autocannon · get all with both tokens · 801,972 WebSocket clients connected

$ autocannon -c 100 -d 60 -w 5 -l -H "x-am-authorization: <token>" -H "x-am-user-authorization: <token>" "http://<server>:38246/api/schema/bench/mongodb/am_bench/customers"
Running 60s test @ http://<server>:38246/api/schema/bench/mongodb/am_bench/customers
100 connections
5 workers

┌─────────┬──────┬───────┬───────┬────────┬──────────┬──────────┬────────┐
│ Stat    │ 2.5% │ 50%   │ 97.5% │ 99%    │ Avg      │ Stdev    │ Max    │
├─────────┼──────┼───────┼───────┼────────┼──────────┼──────────┼────────┤
│ Latency │ 7 ms │ 18 ms │ 49 ms │ 105 ms │ 20.48 ms │ 17.06 ms │ 296 ms │
└─────────┴──────┴───────┴───────┴────────┴──────────┴──────────┴────────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬──────────┬────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg      │ Stdev  │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼────────┼─────────┤
│ Req/Sec   │ 3,613   │ 3,835   │ 4,851   │ 5,159   │ 4,766.67 │ 342.97 │ 3,613   │
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼────────┼─────────┤
│ Bytes/Sec │ 9.89 MB │ 10.5 MB │ 13.3 MB │ 14.1 MB │ 13 MB    │ 938 kB │ 9.88 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴──────────┴────────┴─────────┘

Req/Bytes counts sampled once per second.
# of samples: 300

┌────────────┬──────────────┐
│ Percentile │ Latency (ms) │
├────────────┼──────────────┤
│ 0.001      │ 0            │
├────────────┼──────────────┤
│ 0.01       │ 1            │
├────────────┼──────────────┤
│ 0.1        │ 3            │
├────────────┼──────────────┤
│ 1          │ 6            │
├────────────┼──────────────┤
│ 2.5        │ 7            │
├────────────┼──────────────┤
│ 10         │ 11           │
├────────────┼──────────────┤
│ 25         │ 14           │
├────────────┼──────────────┤
│ 50         │ 18           │
├────────────┼──────────────┤
│ 75         │ 22           │
├────────────┼──────────────┤
│ 90         │ 29           │
├────────────┼──────────────┤
│ 97.5       │ 49           │
├────────────┼──────────────┤
│ 99         │ 105          │
├────────────┼──────────────┤
│ 99.9       │ 220          │
├────────────┼──────────────┤
│ 99.99      │ 263          │
├────────────┼──────────────┤
│ 99.999     │ 279          │
└────────────┴──────────────┘

286k requests in 60.02s, 782 MB read

A restart

API Maker was restarted (systemctl restart api_maker_be) with 601,479 clients connected : the newest left first, down to 75 % of the 801,972 it held. Every client of a restarted server comes back within the same seconds and waits for its turn with its request in the kernel, about 4 KB each : a server needs that room. It takes what Redis keeps of them out first, then closes every client with the code 1001 (Server is going away) ; each client waits one to five seconds, as an application does, connects again with the same tokens and sends its REGISTER again. The server which comes back lets 256 clients in at a time and handles the messages of 256 at a time, the others wait for their turn : its memory comes back to what it was, not higher.

Clients dropped 601,479 of 601,479 connected
All back after 189.1s the restart itself : 45.7 s
A client was away, p50 76.7s its own wait of 1 to 5 s counted
A client was away, p99 173.1s the longest : 177 s

After the restart, with the 601,479 clients back : API Maker 2,055 MB (2,495 MB before it), 2,174 MB of memory available. They were then told again, each for itself, 1,000 notifications a second for 60 seconds : all 60,005 arrived, in 1.27 ms (p50) and 2.66 ms (p99). A client whose subscription had not come back with it would have been told nothing.

Every client leaves at once

At the end of the run, the 601,479 clients closed their connection in the same second, as when a network or a load balancer in front of the server goes. The server had closed every one of their sockets after 18.0 s, and Redis held nothing of them any more after 26.9 s. A socket is closed at once, and Redis is told behind it.

Questions

How many WebSocket connections can API Maker hold on 4 shared vCPUs and 8 GB ?

801,972 clients were connected at the same time on this server, each with both tokens and a subscription of its own, with MongoDB, Redis and two sandboxes on the same machine. Memory is what ends first : a client costs about 8.7 KB of the server in all.

How much memory does a WebSocket client cost ?

About 8.7 KB : 3.3 KB in the API Maker process, 4.4 KB in the Linux kernel (its socket) and 1.1 KB in Redis (its subscription). Measured between 200,000 and 600,000 clients which wait, each connected with both tokens and one subscription.

How many clients can connect each second ?

7,009 clients a second connected with both tokens, subscribed and left, 100 at a time ; 12,826 a second without a subscription. With a can user connect code on the event : 5,916 a second.

How fast does a notification reach a client ?

At 1,000 notifications a second, each for one person among 10,000 : 1.06 ms from the HTTP call to the client (p50), 2.03 ms for 99 % of them. With as many calls as the server takes : 13,441 notifications a second.

Do connected WebSocket clients slow the APIs down ?

Get all with both tokens answered 6,072 requests a second with no WebSocket client, and 4,767 with 801,972 clients connected and waiting. A client which waits costs memory ; its CPU is a ping a minute.