Measure load and scale CoAkka Runtime
Start with one process handling billing.quote. Measure how much work it can take, then use those results to choose the queue, replica count, and traffic split.
What is an app-host?
The app-host is the process running application
logic. The example receives a cart and calculates a quote for
billing.quote. Python and Go app-hosts call CoAkka Runtime
through a connector. A C/C++ app-host can call the C ABI directly.
All three use the native CoAkka Runtime Core.
Record the two ends of the test separately. For example, C++ load generator → Python pricing and C++ load generator → Go pricing use the same load generator, requests, and pricing logic. Use the measured capacity of the Python application when sizing a Python deployment.
Measure one replica
The public Pi 5 benchmark uses small, repeatable payloads and loopback connections. Use it as a reference. To size your service, use the payloads, handler, machine, network and connections your application will run with.
- Choose response-time and error-rate targets. For example, a p99 below 50 ms means about 99% of requests complete in under 50 ms. Keep the package and Core version, CPU budget, and memory limit the same for comparable runs.
- Warm up, then increase the offered requests per second in steps. Hold each step long enough to see whether the queue stabilizes or keeps growing. Check that the generator can sustain the requested rate.
- Record offered and completed rates, p99, refusals, timeouts, peak queue depth, and client and server CPU and memory use. Record the length and arrival rate of each burst.
- Choose an operating level with room for spikes. At that level, p99 and the error rate meet your targets and the queue recovers after a burst.
Size the queue for a burst
Suppose one replica handles 2,000 requests per second. Arrivals rise to 3,000 per second for 1 second and then fall. With an initially empty queue and a steady processing rate, about 1,000 requests would build up. These numbers illustrate the calculation.
| What to estimate | Worked example |
|---|---|
| Work added during the burst | max(0, arrival rate − processing rate) × burst seconds(3,000 − 2,000) × 1 = 1,000 requests |
| Work within the queue wait budget | processing rate × allowed queue wait in secondsAt 100 ms, 2,000 × 0.1 = 200 requests |
| Work within the memory budget | queue memory budget ÷ additional memory per queued requestAt 1 MiB and a measured 4 KiB per queued request, 256 requests |
In this example the wait budget is the tighter limit. Use 200 waiting requests to choose a setting to test. The 1,000 requests that build up exceed that budget, so limit admission or add processing capacity. Include any requests already waiting before the burst.
Estimate memory per queued request
Run 2 tests with the same payload, configuration, and number of requests in progress. Use 2 bursts to reach different queue depths. Record queue depth and process memory at the same time, then divide the increase in memory by the extra requests waiting. Repeat to check the estimate. Budget separately for the application, work in progress, and preallocated memory, and leave headroom for observed peaks.
Start with the package default and read the effective value accepted by
Core. Change queueCapacity after identifying which queue is
filling. After a change, compare the effective capacity with the wait
budget for the queue you measured.
Repeat the burst and sustained-load tests to check waiting time, p99 and RAM.
Estimate the replica count
A replica is a copy of the application that handles the same target. It may be a process on a LAN host or a Pod on Kubernetes. With identical replicas, divide peak demand by the safe capacity of one replica and round up.
For example, peak demand is 5,500 requests per second and a replica meets the targets at 2,000. Start with 3 replicas. If the service must still handle 5,500 after losing one, start by testing 4 replicas with 1 stopped. This is a starting estimate for a test. A shared database, CPU limit, or network link can reduce total capacity.
- The queue drains within budget after a burst. Try adjusting it if needed.
- The queue keeps growing and handlers use all their resources. Test additional processing capacity.
- Handlers mostly wait for a database or another service. Measure that dependency before adding replicas.
Choose a LAN or Kubernetes topology
The caller uses the same billing.quote target in all
3 arrangements. Deployment configuration supplies the destinations.
Each process has its own identity and registers the work it can handle.
| Deployment | Addresses and replica selection |
|---|---|
| Direct LAN peers | List each peer's private DNS name or IP in the route. For example, billing-a.internal:19301 and billing-b.internal:19301. CoAkka Runtime selects the peer. |
| Kubernetes through one Service | Put one Service address in the route. Kubernetes selects a Pod for the connection. With persistent connections, measure the actual distribution by Pod. |
| Kubernetes with individual Pods | Use per-Pod DNS, for example through a StatefulSet and headless Service. List each address in the route so CoAkka Runtime can choose among Pods. |
A CoAkka Runtime cluster here is a group of peers eligible for the same target. The application or orchestrator supplies the peer list and manages starting and replacing Pods or processes. CoAkka Runtime selects a destination, delivers the request, and reports the outcome using the applied route. The application continues to own business data.
Split traffic with weights
Use WEIGHTED_ROUND_ROBIN when the route lists the
individual peers and their handlers do equivalent work. With similar
capacity, start with 1:1. If a Go replica sustains
2,000 requests per second and Python sustains 1,000 in the same test,
try 2:1.
At 2,400 requests per second with both peers eligible, expect roughly 1,600 selections for Go and 800 for Python per second as a comparison point. Count selections, p99 and refusals per peer. With a single Service DNS address, CoAkka Runtime sees one destination and cannot assign individual Pod weights.
See a route with 2:1 weights
This example uses LAN hostnames. For per-Pod routing, substitute the Pod DNS names. Map these settings through the selected connector.
generation: 42
routes:
- target: billing.quote
strategy: WEIGHTED_ROUND_ROBIN
endpoints:
- host: billing-a.internal
port: 19301
weight: 2
flags: [NONE]
- host: billing-b.internal
port: 19301
weight: 1
flags: [NONE]
Weights control the share of selections. Each process still has its
own queue and processing limits. To remove a peer from new selections,
publish a newer route generation with UNAVAILABLE on that
peer or remove it from the list. Core interprets weight: 0 as 1.
If a peer goes away, test the remaining capacity and the application's response to rejection or timeout. For work tied to a particular owner or data key, choose the appropriate route policy before splitting traffic.