Insights into the performance and
configuration of
TCP in Automotive Ethernet Networks
Jörn MIGGE, RealTime-at-Work (RTaW)
Nicolas NAVET, University of Luxembourg
2018 IEEE Standards Association (IEEE-SA) Ethernet & IP @ Automotive Technology Day
9-10 October 2018 | London, England
Use-cases for TCP in future vehicles
2 Service-Oriented
Architectures
Diagnostics & flashing Any TCP-based
applications or protocols
Ethernet TSN
DoIP XCP Some/IP
e.g.: FTP, HTTP, SSH, SIP, car2x, cloud-based services,
electric vehicle charging,
Standard TCP/IP protocols + sockets speed-up the development of applications
requiring off/on-board reliable communications
AUTOSAR TCP/IP stacks
TCP in Automotive Ethernet Networks 3
Applications – AUTOSAR SWCs
AUTOSAR RTE
AUTOSAR TCP/IP
Socket Adaptor signals PDUs
sockets
UDP TCP
IPv4 / IPv6
Ethernet interface datagrams
ADAPTIVE AUTOSAR OS TCP/IP
Ethernet interface datagrams UDP TCP
IPv4 / IPv6
Adaptive Applications
sockets
network binding AUTOSAR ARA
Runtime for Adaptive Applications
Objectives
TCP in Automotive Ethernet Networks 4
1. AUTOSAR TCP/IP design choices
2. Maximum achievable TCP performances with & without interfering traffic
3. Guidelines for configuring AUTOSAR TCP/IP for on-board communication
4. Impact of shapers on TCP traffic: illustration with CBS used for video
TCP performances and configuration has been studied for 40+ years, but
what about TCP – as specified by AUTOSAR – for in-vehicle communication ?
Important study in the literature: “On AUTOSAR TCP/IP Performance in In-Vehicle Network Environments”, in IEEE Communications Magazine, vol. 54, no. 12, pp. 168-173, Dec. 2016.
Techniques & toolset
TCP in Automotive Ethernet Networks 5
– Worst-case Traversal Time (WCTT) analysis – for hard deadline constraints – Timing-accurate Simulation – for TCP throughput constraints
– Optimization algorithms for setting the parameters of all supported protocols
– RTaW-Pegase: modeling / analysis /
configuration of automotive Ethernet TSN – AUTOSAR TCP/IP stack model implemented
in RTaW-Pegase
Toolset
Case-study : Network topology
6
7 video streams (30 FPS) for vision and ADAS
1Gbit/s
↖18%
↗35% 26%↙
→30%
#Nodes 8
#Switches 2
#streams 47
+ TCP streams
Load per link (wo TCP streams)
Min: <1%, max:35%
Link data rates 100Mbit/s and 1Gbit/s (1 link)
→26%
↖16%
TCP connection from ECU1 to ECU6
Loads shown for interfering traffic only – not TCP streams
TCP in Automotive Ethernet Networks
Case-study : Traffic
7 Command & Control (CC)
Video streams Audio Streams
TCP streams
32 streams, 256 to 1024 byte frames
5ms to 80ms period and deadlines
Hard deadline constraints
8 streams: 128 and 256 byte frames
1.25ms period and deadline
deadline constraints (soft)
3 streams (vision): 30x1400 byte frames every 33ms – deadline = 33ms
4 streams (ADAS): 15x1000bytes frames every 33ms – deadline = 10ms
hard and soft deadline constraints
Bulk data = from 64K to 1MB transfers, or
100ms periodic PDUs data, e.g. from CAN networks
Top priority
Second priority level
Lowest priority Third priority level
TCP in Automotive Ethernet Networks
AUTOSAR TCP specification
8
TCP in Automotive Ethernet Networks
AUTOSAR TCP design choices
TCP in Automotive Ethernet Networks 9
– A full-fledged TCP implementation!
– Not included in the specification: selective ack (sack) and timestamp
options, recent congestion control algorithms (BIC, CUBIC, PRR, BBR)
Our view: sound design choices but
configuration is difficult because
- application specific
- subtle interactions between parameters:
e.g. send/receive windows size, TCP task
period, Nagle’s algorithm on/off, time-out
Bulk traffic: Nagle’s algorithm and delayed ack
TCP in Automotive Ethernet Networks 10
– Improve TCP efficiency by postponing both sending of data and sending of ack → buffering on both the sending and receiving sides
64kB = first 43 segments of 1460bytes … 200ms later comes last segment because of Nagle’s algorithm, TCP waits for the delayed ack (200ms). Solution in Autosar is to turn off “Nagle”.
200ms ?!
PDU traffic: Nagle detrimental as well
TCP in Automotive Ethernet Networks 11
– 3 PDU streams over a TCP connection | 8, 20 and 64bytes at the lowest priority level – Maximum latency: from the time the PDU is written in the socket, until receiver reads it
0 5 10 15 20 25 30
TCP traffic alone TCP + interfering
trafic
Maximum latency (ms)
PDU maximum latencies with and without Nagle
Nagle OFF Nagle ON
For PDU’s as well, solution in
Autosar is to turn off Nagle’s
algorithm
Max. achievable performances with TCP
– throughput for bulk traffic
– latencies for PDU traffic
12
TCP in Automotive Ethernet Networks
Throughput – no interfering traffic
TCP in Automotive Ethernet Networks 13
– Experimental conditions: all mechanisms on but Nagle, event-triggered
management of TCP stacks, receive window larger than data, no packet loss
Max. throughput is quickly reached: 96Mbps of TCP data over 100Mbps links!
With interfering traffic (not shown), remaining available bandwidth can be fully used too
But no exponential increase during slow-start ?!
Almost no “slow-start” phase
TCP in Automotive Ethernet Networks 14
0 10000 20000 30000 40000 50000 60000 70000
0 2000 4000 6000 8000 10000 12000 14000 16000 18000
sequence number
time
"exponential" slow start
usable window cwnd sent seq acked seq
0 10000 20000 30000 40000 50000 60000 70000
0 1000 2000 3000 4000 5000 6000
sequence number
time
"linear" slow start
usable window queued seq sent seq acked seq cwnd
Expected: throughput growth Observed: max. throughput from start
Reduced automotive round-trip times changes the usual behavior of TCP
Re-examine what we can expect from TCP in the automotive context
[typical automotive round-trip times]
[Round-trip times of 2ms]
PDU latencies vs receiver reading period
TCP in Automotive Ethernet Networks 15
– PDU TCP streams = 8, 20 and 64 bytes at the lowest priority level
– Maximum latency | Nagle off | window update sent asap after receiver reads buffer
PDU maximum latencies can be
controlled by adjusting
receiver’s reading period
0 5 10 15 20 25 30 35
5 10 15 20
Maximum latency (ms)
Receiver reading period (ms)
PDU maximum latencies vs receiver reading period TCP traffic alone TCP + interfering traffic
Maximum latency ≈ traversal time + reading period
TCPMainFunction may further delay data transfer to application
TCP configuration in a TSN network
16
TCP in Automotive Ethernet Networks
Experimental setup
TCP in Automotive Ethernet Networks 17
– Interfering streams configured so as to meet their latency constraints
– Video under CBS configured with Tight-IdleSlope algorithm = minimum Idle-
Slopes allowing to meet deadline constraints
– TCP traffic: 1MB transfers (=685 segments) between ECU1 and ECU6 every 1s
– Minimum throughput over all TCP transfers collected over long simulations:
sample of 36000 data points (12 hours of functioning)
– Receiver reads TCP buffer every 1ms
Config #2: End-to-end shaping with TSN Credit-Based Shaper (CBS)
Config #1: video streams not shaped
Shaping improves TCP throughput and reduces switch memory usage
18
CBS improves TCP throughput (up to 30%) and reduces memory requirement (up to 14%) for all parameters – larger gains with smaller TCP transfers more subject to bursts of interfering traffic
80 90 100 110 120 130 140 150 160
30 35 40 45 50 55 60 65 70
Memory used in switches (Kb)
TCP throughput (Mbps)
Throughput vs maximum memory for varying receive window sizes (rcwnd)
no CBS CBS for video
rcwnd=5MSS
rcwnd=64KB rcwnd values:
5MSS 8MSS 10MSS 11MSS 20MSS 30MSS 64KB
Larger rcwnd improves throughput but
more memory required in the switches to not
lose packets
TCP in Automotive Ethernet Networks
Configuring TCP receive window size – efficiency areas
19
With or without CBS, larger receive windows improve throughput – the gain drops after a threshold that depends on how often receive buffer is read
rcwnd values:
5MSS 8MSS 10MSS 11MSS 20MSS 30MSS 64KB
80 90 100 110 120 130 140 150 160
30 35 40 45 50 55 60 65 70
Memory used in switches (Kb)
TCP throughput (Mbps)
Throughput vs maximum memory for varying receive window sizes (rcwnd)
no CBS CBS for video
rcwnd=5MSS
rcwnd=64KB Increasing rcwnd size is effective:
4Mbps per additional MSS
much less effective after threshold:
0.13Mbps per MSS
TCP in Automotive Ethernet Networks
In practice, larger receive windows can be detrimental!
TCP in Automotive Ethernet Networks 20
– Memory for switch port SW2 to ECU6 set to 30Kb, packet is dropped if memory full – TCP bulk traffic |average latency | Nagle off
Receive window size should be set wrt switch memory
0 10 20 30 40 50 60 70
20 21 22 23 24 25 26
TCP throughput (Mbps)
Receive window size in MSS
TCP throughput vs receive window size
without CBS with CBS
Larger receive windows means more “in-flight” data.
Packet losses in switches lead to retransmission after
time-out (1s) and drop in throughput!
Takeways
TCP in Automotive Ethernet Networks 21
1
2
3
AUTOSAR TCP is able to use all of the available bandwidth with minimal latencies – if properly configured and enough memory
TCP for soft real-time only as one can just obtain statistical guarantees (i.e., no worst-case analysis)
The use of TSN shapers at higher priority levels improves TCP performance and reduces overall memory requirement
AUTOSAR specifies a full-fledged TCP protocol Need to re-examine what we know about TCP in the
automotive context
AUTOSAR TCP configuration choices make a huge difference, parameters cannot be set in isolation
E.g. best choices for receive window size & polling period depend on switch memory size
22
Thank you for your attention!
Questions? Feedback? contact us at jorn.migge@realtimeatwork.com
nicolas.navet@uni.lu
TCP in Automotive Ethernet Networks
References
23
TCP in Automotive Ethernet Networks
References
1. S. Han and H. Kim, “On AUTOSAR TCP/IP Performance in In-Vehicle Network Environments”, in IEEE Communications Magazine, vol. 54, no. 12, pp. 168-173, Dec. 2016.
2. AUTOSAR, “Specification of TCP/IP Stack”, release 4.3.1., 2017.
3. J. Migge, M. Boyer, N. Navet, J. Villanueva, “Insights on the performance and configuration of AVB and TSN in automotive networks“, Proc. Embedded Real-Time Software and Systems (ERTS 2018), Toulouse, France, January, 2018. Available at http://www.realtimeatwork.com/wp-
content/uploads/Ethernet-QoS_RTaW.pdf.
TCP in Automotive Ethernet Networks 24