TCP Transport

The TCP transport provides high-performance binary communication for internal microservices within the same datacenter or trusted network.

Overview

PropertyValue
Plugin AssemblyStellaOps.Router.Transport.Tcp.dll
Transport Nametcp
Default Port5100
SecurityNetwork isolation (no encryption)
Use CaseInternal services, low-latency communication

Configuration

router.yaml

Router:
  Transport:
    Type: tcp
    Tcp:
      Host: "0.0.0.0"
      Port: 5100
      MaxConnections: 1000
      ReceiveBufferSize: 65536
      SendBufferSize: 65536
      KeepAlive: true
      NoDelay: true

microservice.yaml

routers:
  - host: gateway.internal
    port: 5100
    transportType: Tcp
    priority: 1

Environment Variables

ROUTER__TRANSPORT__TYPE=tcp
ROUTER__TRANSPORT__TCP__HOST=0.0.0.0
ROUTER__TRANSPORT__TCP__PORT=5100
ROUTER__TRANSPORT__TCP__MAXCONNECTIONS=1000

Options Reference

OptionTypeDefaultDescription
Hoststring0.0.0.0Bind address for server
Portint5100TCP port number
MaxConnectionsint1000Maximum concurrent connections
ReceiveBufferSizeint65536Socket receive buffer size in bytes
SendBufferSizeint65536Socket send buffer size in bytes
KeepAlivebooltrueEnable TCP keep-alive probes
NoDelaybooltrueDisable Nagle’s algorithm (lower latency)
ConnectTimeoutTimeSpan00:00:30Connection timeout
ReadTimeoutTimeSpan00:02:00Socket read timeout
WriteTimeoutTimeSpan00:02:00Socket write timeout

Performance Characteristics

MetricTypical Value
Latency (p50)< 1ms
Latency (p99)< 5ms
Throughput100,000+ rps
Memory per connection~2KB

Benchmarks on 10Gbps network with small payloads (<1KB)

Security Considerations

TCP transport does not provide encryption. Use only in:

For encrypted communication, use TLS transport.

Framing Protocol

The TCP transport uses the standard Router binary framing protocol:

┌────────────────────────────────────────────────────────────────┐
│                        Frame Header (24 bytes)                  │
├────────────┬────────────┬────────────┬────────────┬────────────┤
│ Magic (4)  │ Version(2) │ Type (2)   │ Flags (4)  │ Length (8) │
├────────────┴────────────┴────────────┴────────────┴────────────┤
│ Correlation ID (4)                                              │
├─────────────────────────────────────────────────────────────────┤
│                        Frame Payload (variable)                 │
└─────────────────────────────────────────────────────────────────┘

Troubleshooting

Connection Refused

Error: Connection refused to gateway.internal:5100
  1. Verify Gateway is running and listening on port 5100
  2. Check firewall rules allow traffic on port 5100
  3. Verify DNS resolution of hostname

Connection Timeout

Error: Connection to gateway.internal:5100 timed out
  1. Increase ConnectTimeout value
  2. Check network connectivity between services
  3. Verify no network segmentation blocking traffic

Performance Issues

  1. Enable NoDelay: true for latency-sensitive workloads
  2. Tune buffer sizes based on payload sizes
  3. Monitor connection pool exhaustion

See Also