When a market-data provider says a WebSocket connection has “unlimited” subscriptions, the statement is easy to misread.

It does not mean that every subscription has no cost. It means the API does not impose a small, fixed symbol-count ceiling. The real ceiling is determined by the work each subscription creates: the number of updates, message size, serialization overhead, server-side query execution, network traffic, and the latency budget of the consuming application.

This article examines the capacity of a single TickDB WebSocket connection using 100, 500, and 1,000 symbols as test points. It focuses on the metrics that matter in production: message latency, sustained throughput, memory consumption, CPU utilization, bandwidth, and the difference between a protocol limit and an infrastructure limit.

A measured result cannot be generalized from one machine or one market session. The same 1,000-symbol subscription can behave very differently depending on whether the symbols are highly active futures, sparsely updated equities, or mixed instruments with different payload sizes. For that reason, this report separates:

  • What can be concluded from the API’s subscription model.
  • What must be measured on the target deployment.
  • Which results are sufficient to support a production decision.

It also provides a reproducible benchmark harness rather than presenting unverified benchmark numbers as facts.

The Short Answer

“100, 500, or 1,000 symbols” is not, by itself, a meaningful capacity measurement.

A more useful capacity statement looks like this:

A single WebSocket connection maintained a 1,000-symbol subscription for 30 minutes with a measured p99 end-to-end latency of X milliseconds, receiving Y messages per second and consuming Z megabytes of resident memory on the tested deployment.

Without the second half of that sentence, a symbol count says little.

A subscription count becomes meaningful only when paired with:

  1. A defined symbol universe.
  2. A known update rate.
  3. A known payload size.
  4. A latency objective.
  5. A stable server and client environment.
  6. A controlled observation period.

The practical conclusion is that TickDB’s WebSocket subscription limit should not be evaluated by looking for a symbolic maximum. It should be evaluated by measuring the connection against the client’s real workload and operational envelope.

What “Unlimited Subscriptions” Actually Means

An unlimited or effectively unbounded API limit generally refers to the absence of a deliberately small guardrail in the subscription request.

It does not imply unlimited capacity in any of the following dimensions:

  • Messages processed per second
  • Concurrent WebSocket connections
  • CPU time
  • Memory allocation
  • Query concurrency
  • Network bandwidth
  • Result-set size
  • Tail latency

Consider a simple workload model:

[
R = N \times \lambda \times B
]

where:

  • (N) is the number of subscribed symbols
  • (\lambda) is the average update rate per symbol
  • (B) is the average encoded message size

The resulting ingress rate (R) is approximately:

[
R = N \times \lambda \times B
]

This simplified equation omits protocol overhead and multi-message records, but it demonstrates why symbol count alone is insufficient.

For example, suppose a test subscribes to 1,000 symbols with an average update rate of two messages per second and an average message size of 180 bytes:

[
1{,}000 \times 2 \times 180 = 360{,}000 \text{ bytes/s}
]

That appears modest. However, if each update contains multiple fields, partial updates arrive frequently, or the test also requests trades, quotes, order-book events, and status records, the real traffic and processing load can be substantially higher.

There is a second important distinction: subscribed symbols are not necessarily active symbols.

A connection may subscribe to 1,000 symbols but receive updates for only 40 of them at any moment. That produces a different load profile from subscribing to 100 symbols that all trade continuously.

A valid test therefore needs both a large-universe scenario and a controlled-activity scenario.

Test Objectives

The benchmark is designed to answer five operational questions.

1. Can the connection establish the requested subscription?

The test records:

  • Subscription request size
  • Connection establishment time
  • Subscription acknowledgment time, if the protocol exposes one
  • Any server-side validation errors
  • Unexpected disconnects

This establishes whether the API accepts the symbol set. It does not establish sustained capacity.

2. What latency does the client observe?

The primary metric is end-to-end update latency:

[
L = t_{\text{client receipt}} - t_{\text{event timestamp}}
]

Where event timestamps are trustworthy, this is the most useful latency measurement because it includes:

  • Source-data delay
  • Query or publication delay
  • Serialization
  • Network transit
  • Client receive scheduling

The benchmark also reports receive-side processing latency:

[
L_{\text{processing}}
= t_{\text{application callback}} - t_{\text{socket receipt}}
]

The difference helps isolate client-side queueing from upstream delivery delay.

3. What throughput does the connection sustain?

Useful throughput metrics include:

  • Messages per second
  • Bytes per second
  • Updates per subscribed symbol
  • Payload distribution
  • Idle periods
  • Maximum observed one-second message rate

Averages alone are insufficient. A one-second or five-second burst can expose queue growth even when the long-run average looks healthy.

4. What resources does it consume?

For the client, the benchmark records:

  • Resident set size
  • Process memory over time
  • CPU utilization
  • Event-loop delay
  • Garbage-collection pauses, where applicable

For the server, it records:

  • WebSocket-facing process CPU
  • Memory
  • Thread or task utilization
  • Query or publication activity
  • Network traffic
  • Errors, restarts, and disconnects

The exact deployment topology matters. If the TickDB and ClickHouse components run on separate hosts, both need to be measured.

5. Does performance degrade non-linearly?

The key comparison is not simply:

100 symbols: good
500 symbols: good
1,000 symbols: good

It is whether each additional subscription group causes:

  • Increasing CPU per message
  • Growing queues
  • Increasing p95 or p99 latency
  • Memory growth disproportionate to payload volume
  • Larger bursts and more jitter
  • Server throttling or query contention

The latter pattern is more important than the absolute symbol count.

Benchmark Design

The test uses three subscription groups:

Test set Symbols Purpose
S100 100 Small baseline
S500 500 Medium-scale test
S1000 1,000 Large-universe test

Each symbol set is tested for at least three independent runs. One run is not enough to distinguish a stable result from scheduler noise, cache state, or a temporary market-data burst.

Recommended test schedule

  1. Start the server and client machines.
  2. Allow the data source and storage layer to warm up.
  3. Establish the WebSocket connection.
  4. Submit the subscription request.
  5. Run a 60-second warm-up period.
  6. Collect metrics for at least 15–30 minutes.
  7. Run a five-minute cooldown observation.
  8. Repeat three times.
  9. Compare the median run and the worst run.

The cooldown is useful because a queue can continue draining after the subscription stops. A short test may therefore look healthy even though the system was briefly overloaded.

Required control variables

Keep these constant across runs:

  • Server version and configuration
  • TickDB/ClickHouse deployment topology
  • Client hardware and power settings
  • Network path
  • Subscription payload format
  • Requested fields
  • Data retention and cache state
  • Test time window
  • Client-side processing behavior
  • Other workloads on the host

If possible, run the three symbol sets in randomized order. Running 100, then 500, then 1,000 can make the largest test look worse simply because it inherits a warmer cache or a more active market period.

Selecting Symbols

A benchmark based only on the most liquid instruments will understate real-world pressure. A benchmark based only on inactive instruments will overstate the network load while avoiding the hardest concurrency case.

Use at least two symbol universes.

Controlled-activity set

Select symbols with approximately comparable update rates. This isolates the effect of subscription count without allowing activity distribution to dominate the result.

Representative-universe set

Select symbols according to the intended production workload. This may include:

  • Highly active instruments
  • Moderately active instruments
  • Sparse instruments
  • Instruments with unusually large payloads
  • Instruments with frequent partial updates
  • Instruments with gaps or corrections

The representative test is normally the more decision-relevant result, even if it is less tidy.

Avoid duplicate economic exposures

Subscribing to the same underlying through 20 contract months does not create 20 independent data streams. It can nevertheless increase the server’s work if the implementation expands each symbol into related instruments internally.

Record the exact expansion behavior for the deployment being tested. Do not assume it is identical across versions or configurations.

Reference Test Harness

The following Python harness is intentionally protocol-adaptable. TickDB WebSocket deployments can differ in endpoint paths, authentication headers, subscription request schemas, timestamp fields, and record formats.

Place the required request in a JSON template file and replace the placeholder with the encoded symbol list.

Example subscription-template.json:

{
  "type": "subscribe",
  "symbols": "__SYMBOLS__"
}

The template must match the schema accepted by the deployed TickDB WebSocket API. If the API expects a different operation name, argument structure, or field encoding, adapt the template rather than changing the measurement logic.

Install the dependencies:

python -m pip install websockets psutil

Save the harness as websocket_capacity_test.py:

import argparse
import asyncio
import json
import os
import statistics
import time
from collections import deque
from pathlib import Path

import psutil
import websockets


def percentile(values, q):
    if not values:
        return None

    ordered = sorted(values)
    position = (len(ordered) - 1) * q
    lower = int(position)
    upper = min(lower + 1, len(ordered) - 1)
    fraction = position - lower

    return ordered[lower] * (1 - fraction) + ordered[upper] * fraction


def load_symbols(path):
    with open(path, "r", encoding="utf-8") as handle:
        payload = json.load(handle)

    symbols = payload.get("symbols")
    if not isinstance(symbols, list) or not symbols:
        raise ValueError("The symbol file must contain a non-empty 'symbols' array")

    return [str(symbol) for symbol in symbols]


def build_subscription(template_path, symbols):
    template = Path(template_path).read_text(encoding="utf-8")
    encoded_symbols = json.dumps(symbols, ensure_ascii=False)

    if "__SYMBOLS__" not in template:
        raise ValueError("The request template must contain the __SYMBOLS__ placeholder")

    return template.replace("__SYMBOLS__", encoded_symbols)


def extract_timestamp(record, configured_field):
    if configured_field:
        if configured_field not in record:
            return None
        value = record[configured_field]
    else:
        value = None

        for field in (
            "timestamp",
            "ts",
            "event_time",
            "event_timestamp",
            "time",
        ):
            if field in record:
                value = record[field]
                break

    if value is None:
        return None

    if isinstance(value, (int, float)):
        # Assume seconds for values large enough to be epoch-like.
        if value > 10_000_000_000:
            return value / 1_000_000_000
        if value > 10_000_000:
            return float(value)
        return float(value)

    if isinstance(value, str):
        try:
            from datetime import datetime

            parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))
            return parsed.timestamp()
        except ValueError:
            return None

    return None


async def run_test(args):
    symbols = load_symbols(args.symbols)
    request = build_subscription(args.template, symbols)

    headers = {}
    if args.token:
        headers["Authorization"] = f"Bearer {args.token}"

    latencies = deque(maxlen=args.max_samples)
    receive_to_callback = deque(maxlen=args.max_samples)

    message_count = 0
    byte_count = 0
    malformed_count = 0
    timestamp_missing_count = 0

    received_at_start = 0
    received_at_end = 0

    connection_started = time.perf_counter()
    connection_established = None

    async with websockets.connect(
        args.url,
        additional_headers=headers,
        ping_interval=args.ping_interval,
        ping_timeout=args.ping_timeout,
        max_queue=args.max_queue,
    ) as socket:
        connection_established = time.perf_counter()

        await socket.send(request)
        subscription_sent = time.perf_counter()

        started = time.perf_counter()
        deadline = started + args.duration
        one_second_buckets = {}

        while True:
            now = time.perf_counter()

            if now >= deadline:
                break

            try:
                raw_message = await asyncio.wait_for(
                    socket.recv(),
                    timeout=min(1.0, max(0.01, deadline - now)),
                )
            except asyncio.TimeoutError:
                continue

            socket_received = time.perf_counter()

            try:
                record = json.loads(raw_message)
            except (json.JSONDecodeError, TypeError):
                malformed_count += 1
                continue

            callback_started = time.perf_counter()

            message_count += 1
            byte_count += len(raw_message)

            bucket = int(socket_received - started)
            one_second_buckets[bucket] = one_second_buckets.get(bucket, 0) + 1

            event_timestamp = extract_timestamp(record, args.timestamp_field)

            if event_timestamp is None:
                timestamp_missing_count += 1
            else:
                latency_ms = (socket_received - event_timestamp) * 1000

                if latency_ms < 0:
                    # A negative value usually indicates clock skew or a future timestamp.
                    pass
                else:
                    latencies.append(latency_ms)

            receive_to_callback.append(
                (callback_started - socket_received) * 1000
            )

            # Insert the production application's processing here.
            # Do not perform expensive work during a baseline test.

        ended = time.perf_counter()
        received_at_start = started
        received_at_end = ended

    elapsed = received_at_end - received_at_start
    subscription_ms = (
        subscription_sent - connection_established
    ) * 1000

    message_rates = list(one_second_buckets.values())
    process = psutil.Process(os.getpid())

    result = {
        "symbols": len(symbols),
        "duration_seconds": round(elapsed, 3),
        "connection_ms": round(
            (connection_established - connection_started) * 1000, 3
        ),
        "subscription_send_ms": round(subscription_ms, 3),
        "messages": message_count,
        "bytes": byte_count,
        "messages_per_second": round(message_count / elapsed, 3),
        "bytes_per_second": round(byte_count / elapsed, 3),
        "peak_messages_in_one_second": max(message_rates, default=0),
        "malformed_messages": malformed_count,
        "missing_timestamp_messages": timestamp_missing_count,
        "latency_ms": {
            "samples": len(latencies),
            "p50": round(statistics.median(latencies), 3) if latencies else None,
            "p95": round(percentile(latencies, 0.95), 3) if latencies else None,
            "p99": round(percentile(latencies, 0.99), 3) if latencies else None,
            "max": round(max(latencies), 3) if latencies else None,
        },
        "receive_to_callback_ms": {
            "p50": round(
                statistics.median(receive_to_callback), 3
            ) if receive_to_callback else None,
            "p95": round(
                percentile(receive_to_callback, 0.95), 3
            ) if receive_to_callback else None,
            "p99": round(
                percentile(receive_to_callback, 0.99), 3
            ) if receive_to_callback else None,
        },
        "client_memory_mib": round(
            process.memory_info().rss / 1024 / 1024, 2
        ),
    }

    output = json.dumps(result, indent=2)
    print(output)

    if args.output:
        Path(args.output).write_text(output + "\n", encoding="utf-8")


def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("--url", required=True)
    parser.add_argument("--symbols", required=True)
    parser.add_argument("--template", required=True)
    parser.add_argument("--output")
    parser.add_argument("--token", default=os.getenv("TICKDB_TOKEN"))
    parser.add_argument("--timestamp-field")
    parser.add_argument("--duration", type=int, default=1800)
    parser.add_argument("--ping-interval", type=int, default=20)
    parser.add_argument("--ping-timeout", type=int, default=20)
    parser.add_argument("--max-queue", type=int, default=1024)
    parser.add_argument("--max-samples", type=int, default=1_000_000)
    return parser.parse_args()


if __name__ == "__main__":
    asyncio.run(run_test(parse_args()))

Run the three symbol sets with the same options:

python websocket_capacity_test.py \
  --url "$TICKDB_WS_URL" \
  --symbols symbols-100.json \
  --template subscription-template.json \
  --duration 1800 \
  --output result-100.json

python websocket_capacity_test.py \
  --url "$TICKDB_WS_URL" \
  --symbols symbols-500.json \
  --template subscription-template.json \
  --duration 1800 \
  --output result-500.json

python websocket_capacity_test.py \
  --url "$TICKDB_WS_URL" \
  --symbols symbols-1000.json \
  --template subscription-template.json \
  --duration 1800 \
  --output result-1000.json

The symbol files use the same basic structure:

{
  "symbols": ["SYMBOL_001", "SYMBOL_002"]
}

The actual symbol identifiers must match the TickDB deployment’s data and subscription conventions.

Measuring Server-Side Resource Usage

The Python harness measures the client, but a complete report must include the server.

For a Docker-based deployment, sample container statistics at regular intervals:

while true; do
  date -u +"%Y-%m-%dT%H:%M:%SZ"
  docker stats --no-stream \
    --format "{{.Name}},{{.CPUPerc}},{{.MemUsage}},{{.NetIO}},{{.BlockIO}}"
  sleep 1
done

If TickDB and its underlying data services run on separate hosts, collect equivalent metrics from every relevant container or process.

At minimum, record:

Resource Useful metric
CPU Average and peak utilization by process
Memory Resident memory and high-water mark
Network Inbound and outbound bytes per second
Storage Read and write volume where applicable
Errors Failed queries, rejected subscriptions, disconnects
Event loop Queue delay and task-scheduling delay where exposed

CPU averages should be supplemented with percentiles. A server that averages 35% CPU but regularly reaches 95% for several seconds may produce unacceptable latency spikes.

Publishing Results

A credible report should include the raw configuration and per-run results, not just a final conclusion.

Use a table such as this:

Metric S100 S500 S1000
Runs completed — — —
Subscription accepted — — —
Messages received — — —
Messages/second — — —
MB/second — — —
Peak messages in one second — — —
Latency p50 — — —
Latency p95 — — —
Latency p99 — — —
Maximum latency — — —
Client RSS — — —
Server CPU average — — —
Server CPU peak — — —
Server memory — — —
Disconnects — — —
Data gaps detected — — —

These cells should remain unpopulated until they are derived from recorded test output.

The same principle applies to benchmark screenshots, charts, and narrative claims. A p99 latency value without the observation duration, sample count, symbol definition, and client hardware is not reproducible evidence.

How to Interpret the 100/500/1,000 Comparison

Suppose the completed runs produced the following pattern:

S100:  low latency, low resource use
S500:  slightly higher latency, modest resource increase
S1000: sharply higher tail latency, growing queues, possible throttling

That would indicate a practical capacity boundary below 1,000 symbols for the tested workload.

The opposite pattern would be:

S100:  baseline
S500:  approximately proportional resource increase
S1000: approximately proportional resource increase

This would indicate that the connection was not constrained by the 1,000-symbol request itself. More symbols would then require a separate test.

A third pattern deserves special attention:

S100:  low traffic
S500:  much higher traffic
S1000: only slightly higher traffic

This may mean that activity is concentrated in a small subset of the universe. It is not evidence that the larger subscription is computationally free; it may simply mean that most symbols are idle.

Proportional versus super-proportional growth

For each metric (M), calculate the growth ratio:

[
G_M(N) = \frac{M(N)}{M(100)}
]

For example, if message volume grows by roughly 10 times between S100 and S1000, but p99 latency grows by 50 times, the system is degrading non-linearly.

The most important warning signs are:

  • p99 latency grows faster than throughput.
  • Memory grows beyond the expected retained window.
  • Client event-loop delay rises.
  • Server queues accumulate.
  • The server begins rejecting or delaying other consumers.
  • Data gaps appear even though the socket remains connected.

Common Benchmark Mistakes

Testing only symbol count

A test that changes the symbol count but not the workload can produce misleading conclusions. Subscription growth and update-rate growth should be measured separately.

Using a quiet period

Testing outside active market hours suppresses exactly the concurrency and burst behavior most likely to affect production.

Ignoring payload size

The same symbol may return different response sizes depending on requested fields, record types, and serialization settings. Measure bytes per message, not just messages per second.

Treating the socket as the only queue

Latency can accumulate before data reaches WebSocket. A client-side timestamp cannot reveal upstream queueing unless the event timestamp is reliable and clocks are synchronized.

Running multiple tests simultaneously

Concurrent benchmark clients can contaminate the result through shared server, storage, network, or CPU resources. Run them sequentially unless the objective is explicitly to test aggregate concurrency.

Hiding client-side queueing

If the client cannot process updates as quickly as they arrive, the server may be performing well while the application still experiences unacceptable latency.

Averaging away tail latency

Market-data consumers frequently trade average performance for predictable tail behavior. Publish p95, p99, and maximum latency.

Treating memory as a single number

Track resident memory and allocation behavior over time. A temporary startup spike is different from sustained growth caused by retained queues or unbounded application-side buffers.

Testing the wrong deployment

A laptop connected to a remote data center and a production service on the same host do not represent the same path. Include network latency and bandwidth in the test plan.

Capacity Planning Beyond the Test

For planning purposes, estimate the expected message rate from observed production data:

[
\lambda_{\text{aggregate}}
= \sum_{i=1}^{N} \lambda_i
]

Estimate the bandwidth requirement as:

[
BW = \lambda_{\text{aggregate}} \times \overline{B}
]

Then add allowances for:

  • Protocol and transport overhead
  • Peak-to-average activity ratios
  • Multiple record types
  • Retry or replay traffic
  • JSON versus binary serialization
  • Client-side aggregation
  • Heartbeats and control messages

A practical design target should be expressed as a service level, not a subscription count:

Single connection:
- 1,000-symbol universe
- 4,000 average messages/second
- 8,000 peak messages/second
- p99 event-to-receipt latency below 25 ms
- no sustained queue growth
- no application-level data gaps

The example is a target definition, not a claimed TickDB benchmark result.

Choosing One Connection or Several

A single WebSocket connection simplifies deployment, but it also creates a concentration point.

One connection is usually preferable when:

  • The workload fits comfortably within the measured envelope.
  • Low and predictable latency is required.
  • The client can process messages without blocking the receive loop.
  • Server and client capacity can be monitored.

Multiple connections may be preferable when:

  • The symbol universe is very large.
  • Different consumers need different field sets.
  • Failure isolation is important.
  • One application wants to parallelize decoding or processing.
  • The server’s per-connection handling becomes a bottleneck.

A multi-connection design does not automatically increase total capacity. It may shift contention from the WebSocket layer into the query, publication, storage, or CPU layer.

Test the architecture that will actually be deployed.

The Production Acceptance Test

Before approving a symbol count for production, require all of the following:

  1. The intended symbol universe is tested for at least 30 minutes.
  2. At least three runs are completed.
  3. The worst run remains within the latency objective.
  4. No sustained queue growth is observed.
  5. CPU and memory remain below operational thresholds.
  6. No disconnects, throttling responses, or unexplained gaps occur.
  7. A busy-market replay or historical high-activity window is included when possible.
  8. Client-side decoding and application processing are included.
  9. The result is recorded with hardware, software, network, payload, and symbol-set details.
  10. Rejection criteria are defined before the test begins.

Example rejection criteria:

Reject the configuration if any of the following occurs:

- p99 event-to-receipt latency exceeds 25 ms for more than 5 seconds
- event-loop delay exceeds 10 ms
- server CPU remains above 85% for 3 minutes
- memory grows by more than 10% after the first 5 minutes
- any unexplained data gap is detected
- the WebSocket connection disconnects

Thresholds should be derived from the application’s requirements, not copied mechanically.

Final Assessment

The practical boundary of a TickDB WebSocket subscription is not defined by whether the API accepts 100, 500, or 1,000 symbols. Those are useful test points, but they are not universal capacity limits.

A production decision should be based on the relationship among subscription size, update activity, payload volume, latency, and resource utilization. If the representative test shows proportional scaling with stable tail latency, the connection has meaningful headroom. If latency or queue depth grows disproportionately, the 1,000-symbol test has exposed a workload or infrastructure boundary even if the API accepted the request.

For teams evaluating TickDB, the right next step is to run the benchmark against the actual subscription universe and the actual deployment—not to extrapolate from an undocumented maximum.

If the intended workload includes a large symbol universe, TickDB can be evaluated using this harness with the subscription schema, authentication method, and representative symbol list supplied for the target deployment. The resulting measurements will show whether a single-connection architecture fits the required latency and throughput envelope, and whether additional connections or workload partitioning are warranted.