Reserving capacity for low-latency trading hosts on AWS
In SRE when latency matters as much as uptime I treated noisy neighbours as a capacity problem: anything sharing the host can steal time, and in the cloud that can include other tenants. This post is about the AWS controls: what isolation actually guarantees, how reserved capacity differs from a billing discount, and how to keep a trading host launchable and predictable.
1. What a noisy neighbour is on EC2
The physical host. By default, instances use shared tenancy: more than one AWS account can run on the same server. Nitro isolates memory and vCPUs, but you do not own the box. Watch %steal in mpstat.
The network. Instance bandwidth is an allowance, not a private wire. Smaller sizes advertised as “up to” a rate have a lower baseline and may burst for a limited time, typically 5 to 60 minutes, using network I/O credits. AWS documents that burst is best effort, because burst bandwidth is a shared resource. Packet-per-second and connection-tracking allowances are separate, so small-packet floods can be throttled while average throughput still looks fine.
EBS. EBS is network-attached. Even when the instance runs on dedicated hardware, AWS documents that the EBS volume itself does not. EBS-optimised bandwidth is an entitlement, not a private array. Your own account can also be the neighbour: a backup job, a log shipper, or another instance on the same host.
2. Isolation: what each option actually guarantees
Default tenancy, Nitro virtualisation. This is the usual EC2 instance. Nitro offloads networking and storage to dedicated cards and isolates guests from each other. It does not promise that you are the only tenant on the server, and it does not remove the shared paths above.
Dedicated Instances. These run on hardware that is not shared with other AWS accounts. They may share a host with non-dedicated instances from the same account, and you get no visibility or affinity, so a stop and start may land on a different server. Capacity Reservations work with Dedicated Instances.
Dedicated Hosts. You get the physical server, visibility of sockets and cores, and control over placement and host affinity. Billing is per host. Capacity Reservations are not supported; the host is the reserved capacity. You cannot launch Dedicated Hosts in placement groups.
Bare metal (.metal). No hypervisor on the server, so you get processor features the guest would otherwise not see. Networking and storage still go through Nitro cards, and the BIOS still belongs to AWS, as in the tuning checklist. Metal is closer to a data-centre host. It is not a different network or storage fabric.
Tenant isolation is not reserved capacity, and reserved capacity is not tenant isolation.
3. Billing discounts are not launchable capacity
Savings Plans and regional Reserved Instances reduce the bill. They do not reserve a slot in an Availability Zone. If an AZ is tight, RunInstances can still fail with InsufficientInstanceCapacity.
Zonal Reserved Instances reserve capacity and apply a discount, but only in that AZ, for that size and platform, with a one- or three-year term, and they cannot reserve capacity inside a placement group. On-Demand Capacity Reservations (ODCRs) reserve capacity in one AZ, for a matching instance type, platform and tenancy, with no discount on their own. Unused reservations are billed at the On-Demand rate. You can combine an ODCR with a Savings Plan or a regional Reserved Instance to get the discount back. A request can still fail if AWS does not have the capacity when you ask.
An open reservation automatically absorbs any matching instance in the account, including ones launched by another service. A targeted reservation only accepts instances that name it. For hosts you care about, targeted is usually the safer default. Future-dated reservations must be targeted.
Create the reservation in the cluster placement group if the instances must launch there; you cannot add a placement group later. Capacity Blocks (time-bounded ML and GPU capacity, no placement groups) are not a substitute for an always-on trading host.
4. Placement groups
A cluster placement group packs instances close together in one AZ, on the same high-bisection segment of the network: the usual choice for low-latency traffic between hosts. AWS documents higher single-flow bandwidth inside a cluster group (up to 10 Gbps, versus 5 Gbps outside). Traffic to the internet or over Direct Connect to on-premises resources stays at the 5 Gbps single-flow limit even inside the group.
Mixing instance types, or adding instances later, makes InsufficientInstanceCapacity more likely. Launch the set together, keep the type the same, and put an ODCR in the group so a scale-down does not lose the slots. If a later launch fails, AWS’s documented recovery is to stop and start the whole group so it can be placed on hardware that fits.
Partition and spread groups separate instances across racks or distinct hardware so a failure is less correlated. That helps independence, not the tightest path between two trading hosts. They can also fail when there is not enough distinct hardware. You cannot put an instance in more than one group, and you cannot use ODCRs with spread or partition groups.
5. Instance choice
- No burstable T types. They run at a baseline and spend CPU credits to go above it. When the credits are gone, you are back at baseline.
- Do not depend on network burst. Prefer a size whose documented bandwidth is a number, not “up to”. Look up the baseline with
describe-instance-types. Network-optimised types (thensuffix) exist when the network is the scarce resource. - ENA is the Nitro NIC. Keep the driver current. ENA Express can raise single-flow bandwidth to 25 Gbps, up to the instance limit, and can reduce tail latency between instances in the same AZ under load. AWS also notes it may add tens of microseconds to median latency when the path is quiet, and that high packet-rate, uncongested latency may be better on standard enhanced networking. It cannot be used in Local Zones. Measure it.
- EBS-optimised and io2. Most current types are EBS-optimised by default. If the host depends on networked disk, provision IOPS (io2, or io2 Block Express where supported) and stay within the instance’s EBS bandwidth. Instance store keeps ephemeral I/O on local NVMe, off the EBS path.
- CPU options. On virtualised instances,
ThreadsPerCore=1turns off simultaneous multithreading; you still pay for the instance type. CPU options are not available on bare metal; there you would do it in the guest, if at all.
Once tenancy and size are right, in-host noise remains: other processes, interrupts, and kernel work on the same vCPUs, visible as run-queue wait and a long tail on calls that sleep. The tuning checklist covers CPU isolation, IRQ affinity, and keeping housekeeping off the critical cores.
6. Measure the tail, and the allowances
The number that matters is still the application’s tail, on the instance type you will run, as in How to measure latency without fooling yourself. CloudWatch NetworkIn and NetworkOut averages hide microbursts. The ENA driver exposes cumulative counters since the last reset, including bw_in_allowance_exceeded, bw_out_allowance_exceeded, pps_allowance_exceeded, conntrack_allowance_exceeded and linklocal_allowance_exceeded. The last of those is drops to the link-local services (DNS, instance metadata, and the Amazon Time Sync Service) when that interface exceeds its packet-rate limit, the same shared cap mentioned in Time sync on AWS. These metrics are not in CloudWatch by default; scrape them with ethtool -S or the CloudWatch agent. A rising allowance counter, %steal, and EBS queue time (if the host waits on disk) are the useful signals.
7. Operate it so a replacement still works
Latency to a venue or market-data source depends on region, AZ, and how you leave AWS (for example Direct Connect). AWS also offers Local Zones and Outposts when the right place is outside a Region. Choose by measurement; not every EC2 feature exists in every location.
Reserve failover capacity where you would actually fail over. A second AZ protects against a zone failure and adds distance. As in the earlier SRE post, measure latency after failover, not only whether the instance started. If the standby must come up during a capacity squeeze, it needs its own reservation in that AZ.
Pin the launch: instance type, AMI, CPU options, tenancy, placement group, Capacity Reservation target, and EBS and network settings, in a launch template. An open reservation plus a loose launch is how a batch job consumes the slot you wanted for a trading host.
Watch the reservation. The AWS/EC2CapacityReservations namespace publishes used, available and total counts, plus InstanceUtilization, every five minutes. Alarm on unexpected unused capacity, and on launches that fail while a reservation sits empty, often a targeted reservation the template does not name, or a platform or tenancy mismatch.
Drill replacements outside busy hours. Confirm the new host lands in the reservation and the placement group, that the tuning is still applied, and that the application tail matches the baseline. A reservation that has never launched a replacement is unproven.
Summary
- Noisy neighbours on EC2 are shared hosts, shared network allowances and a shared EBS path.
- Dedicated Instances, Dedicated Hosts and bare metal each buy a different guarantee, including same-account sharing and multi-tenant EBS.
- Savings Plans and regional Reserved Instances discount the bill. Zonal Reserved Instances and targeted ODCRs, including inside a cluster placement group, are what reserve a slot.
- Prefer fixed-performance sizes with a stated network baseline. Treat ENA Express as something to measure.
- Keep in-host isolation, watch the tail, and prove with a launch template and a replacement drill that you can get another quiet host.
References
- AWS, Reserve compute capacity with EC2 On-Demand Capacity Reservations: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-capacity-reservations.html
- AWS, Regional and zonal Reserved Instances (scope): https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/reserved-instances-scope.html
- AWS, Amazon EC2 Dedicated Instances and Dedicated Hosts: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-instance.html and https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-overview.html
- AWS, Placement groups, Placement strategies, and Capacity Reservations with cluster placement groups: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html, https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-strategies.html, and https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cr-cpg.html
- AWS, Amazon EC2 instance network bandwidth: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-network-bandwidth.html
- AWS, Monitor network performance for ENA settings and ENA Express: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-network-performance-ena.html and https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ena-express.html
- AWS, Specify CPU options, Burstable performance instances, and Amazon EBS-optimized instances: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-specify-cpu-options.html, https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html, and https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html
- AWS, Monitor Capacity Reservations usage with CloudWatch metrics: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/capacity-reservation-cw-metrics.html
- AWS Well-Architected Financial Services Industry Lens, FSIPERF04: https://docs.aws.amazon.com/wellarchitected/latest/financial-services-industry-lens/fsiperf04.html