Skip to content

Instantly share code, notes, and snippets.

@ptupitsyn
Created December 3, 2025 10:40
Show Gist options
  • Select an option

  • Save ptupitsyn/86056d4143811ba5dde6b2d1704fa948 to your computer and use it in GitHub Desktop.

Select an option

Save ptupitsyn/86056d4143811ba5dde6b2d1704fa948 to your computer and use it in GitHub Desktop.
Ignite 3.1 client connection limit test
// Stats (Ubuntu 22.04, i9-12900H, 64 GB RAM)
// Connected 200000 connections in 00:02:49.2601996
// Verified connectivity in 00:00:09.1446883
// Started 8000 connections, 5071.840078796107 conns/sec, total time 00:00:02.1065415
// Started 199000 connections, 575.1123798345816 conns/sec, total time 00:02:47.4392904
// Started at 200 MB, ended at 900 MB java heap on server
using System.Diagnostics;
using Apache.Ignite;
// Increase ephemeral port range - default is usually "32768 60999"
// sudo sysctl -w net.ipv4.ip_local_port_range="1024 65535"
int connectionCount = 200_000;
int heartbeatIntervalSeconds = 10;
// Use different local addresses to work around ephemeral port exhaustion.
var addrs = Enumerable.Range(1, 255).Select(x => "127.0.0." + x).ToArray();
var conns = new List<IIgniteClient>(connectionCount);
var sw = Stopwatch.StartNew();
var batchSw = Stopwatch.StartNew();
const int batchSize = 1000;
for (int i = 0; i < connectionCount; i++)
{
var cfg = new IgniteClientConfiguration(addrs[i % addrs.Length])
{
HeartbeatInterval = TimeSpan.FromSeconds(heartbeatIntervalSeconds)
};
var client = await IgniteClient.StartAsync(cfg);
conns.Add(client);
if (i % batchSize == 0)
{
Console.WriteLine($"Started {i} connections, {batchSize / batchSw.Elapsed.TotalSeconds} conns/sec, total time {sw.Elapsed}");
batchSw.Restart();
}
}
Console.WriteLine($"Connected {conns.Count} connections in {sw.Elapsed}, sending {connectionCount / heartbeatIntervalSeconds} heartbeats per second");
// Verify connectivity.
sw.Restart();
foreach (var conn in conns)
{
await conn.GetClusterNodesAsync();
}
Console.WriteLine($"Verified connectivity in {sw.Elapsed}");
await Task.Delay(Timeout.InfiniteTimeSpan);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment