Data Streams and Fast Processing: Comparing gRPC and WebSocket with UDP and QUIC

Data Streams and Fast Processing: Comparing gRPC and WebSocket with UDP and QUIC

Data Streams and Fast Processing: Comparing gRPC and WebSocket with UDP and QUIC
ERPC provides UDP Forwarding to deliver raw Shreds directly over UDP, alongside Yellowstone gRPC and WebSocket for receiving data. For transaction submission, ERPC provides SWQoS and is preparing SWQoS QUIC. This article explains why Shreds delivery uses UDP directly without adding QUIC, while transaction submission uses QUIC’s guarantees and controls, through the mechanisms of connections, streams and data. [1] [2] [3] [30] [31]
The underlying comparison is between gRPC and WebSocket using TCP, and communication using UDP directly or QUIC over UDP. Both UDP and QUIC can send and receive data. The choice depends on the guarantees the data needs and the processing and waits added to its delivery path. We also examine why direct UDP and QUIC have distinct uses within the same UDP family.
Imagine updates arriving in the order 1 → 3 → 3 → 2 → 5. If each update contains a complete current state, processing may advance to 5. If the updates are deltas to apply to a previous state, skipping the missing update 4 produces the wrong value. The same arrival order therefore permits different processing decisions depending on what the data contains. Chapter 7 examines this difference using the same input.
Prices, game positions and account states can generate a continuing flow of updates, which we refer to here as a data stream. Fast processing depends on both computation time and the wait before the next update becomes usable. We separate waiting for communication to deliver later data to the application from waiting until the application can correctly apply an update it has received.
On the TCP side, we begin with how the familiar gRPC and WebSocket interfaces relate to TCP underneath them. Typical server-side gRPC uses TCP through HTTP/2, which can carry multiple exchanges over one connection. Conventional WebSocket connections opened through HTTP/1.1 also use TCP. TCP retransmits missing data and delivers bytes to the application in order. We examine both the value of that ordering guarantee and the cases where recovering a gap delays the use of newer updates. [11] [12] [13] [4] [10]
Within the UDP family, consider direct UDP use first. The application can design whether to wait for missing data to be retransmitted; UDP itself does not guarantee arrival order or retransmission. Where a new update independently supports a correct decision, a design can process it without waiting for an older update. QUIC also runs over UDP, but its ordinary Streams preserve reliability and order and allow independent work to be placed on separate Streams. QUIC DATAGRAM provides delivery without retransmitting its payloads. The required guarantees therefore also guide choices within this family. [5] [7] [9]
For the foundations, read Chapters 1–5 on data dependencies and the two transport families. If you already implement subscriptions, you can start with the uses, receiver policies and measurement methods in Chapters 6–8, then return to the mechanisms you need. The four AI instructions at the end are separate tools: choose one for diagnosis, a UDP adoption decision, correctness or a performance comparison.

1. Data dependencies determine when processing can continue

Imagine updates 1, 2 and 3 being sent to a display. Data from the middle of update 2 is lost, while data belonging to update 3 reaches the receiver. Whether the application should wait for update 2 depends on what update 3 contains.
If update 3 says “the current value is 102” and independently describes everything the application needs, it may be possible to advance the display to 102. If it says “subtract 2 from the previous value”, applying it without update 2 is incorrect. Even within market data, displaying a current price and reconstructing an order book from deltas have different requirements.

Figure 1 | Wait for the missing update, or use the latest state?

With update 2 missing, an independent current state can allow update 3 to be used before recovery.
Illustrative model. The numbers identify application updates, not the smaller units sent across the network, called packets. One update does not necessarily correspond to one packet. The lower path may accept update 3 only when it is validated, within its deadline, belongs to the same entity and generation, and independently contains the state required for the decision. This does not apply to dependent deltas or required history. Here, a generation is an identifier that distinguishes a new update sequence from an earlier one when numbering restarts, for example after a restart.
Begin by separating three forms of data. A snapshot captures the state needed at one point in time. This article uses “independent snapshot” for a complete current state that can be used without the preceding updates.
FormExamplesWhen an earlier update may be skipped
Current stateA complete position update or a current value for displayA newer update independently supports the required correct decision
DeltaAn order-book addition or deletion, or a change applied to previous stateIts prerequisites are available, or the receiver can resynchronise with a complete state
History or business eventA fill, an order transition, or an audit recordEach required event generally needs recovery and reconciliation; the latest state is insufficient
“Complete” refers to the state needed by the application. A current value for one instrument does not establish that all the information needed to compare several markets is available. Entity identity, scope and time alignment can also be part of correctness.
Four terms help keep the decision clear. Speed describes how quickly a defined operation or interval completes. Reliability describes which delivery, ordering and failure conditions a communication mechanism handles. Real-time behaviour means meeting the required deadline. Correctness means that the resulting decision or state satisfies the application’s requirements. A quickly delivered wrong state and an accurate notification that misses its deadline can both be failures for their intended use.
The following chapters separate the conditions under which a transport can deliver later data from the conditions under which the application can apply an update. Removing a transport ordering wait does not remove dependencies between deltas.

2. The TCP family: ordering and retransmission beneath gRPC and WebSocket

A TCP connection is the context in which two endpoints maintain sending and receiving state and manage an ongoing exchange. An initial exchange establishes the connection, which can then carry many messages. Each update does not require a new connection. [4]
Within that connection, TCP provides a reliable, ordered byte stream in each direction. It detects missing bytes and retransmits data so that the receiver can read them in order. TCP does not define message boundaries: one read can end partway through a message or contain bytes from several messages. [4]
Mechanisms such as gRPC and WebSocket use framing information to assemble messages, whose contents the application interprets as updates. Protocol frames, messages and application updates do not necessarily correspond one for one. [10] [12]
This is useful for API responses, files and messages that cannot be interpreted with missing pieces. Applications do not have to rebuild byte ordering themselves. TCP can also keep multiple pieces of data in flight. It does not require each item to arrive before the next is sent.
When bytes are missing in the middle of the stream, however, later bytes that have reached the receiver cannot normally be delivered ahead of that gap through the ordered TCP stream. This ordering wait is Head-of-Line Blocking in the transport layer, the layer responsible for delivering data. Even when a newer update independently represents the required state, the application cannot use it before it can read the necessary bytes. [4]
TCP also provides flow control, which respects the receiver’s capacity, and congestion control, which responds to the network path. The former protects the receiver; the latter protects the network. The existence of waiting does not make either responsibility unnecessary. [4]
With an established connection, little loss and sufficient processing capacity, TCP can meet the deadlines of many applications. A protocol name alone does not determine latency. The path, congestion, message size, implementation and queues, which hold work waiting to be processed, all matter.
Reliability also has a boundary. A TCP connection can fail, and a TCP acknowledgement, or ACK, does not prove that an order was accepted or a database write was committed. If a response never arrives, the application must distinguish an operation that was never executed from one that completed but lost its response. Business identifiers and state reconciliation address that question.
Re-establishing a TCP connection does not itself guarantee recovery of every notification generated during the disconnection. Check the API and endpoint specifications for history retrieval and resynchronisation.

3. The UDP family: let the application decide what to wait for

UDP sends individual units called datagrams. UDP itself does not require a TCP-style connection-establishment exchange; this is what connectionless means. UDP itself does not guarantee delivery, arrival order or duplicate suppression, and does not provide a mechanism that retransmits missing data and waits for it to become complete. [5]
UDP preserves datagram boundaries. If an application splits one update across several datagrams, it still has to assemble the fragments needed for that update. [6]
If update 2 is missing, the application can still inspect update 3 when it arrives. When update 3 is an independent current state that passes validation and meets its deadline, the application can proceed without waiting for update 2 to be retransmitted. A major reason to choose UDP for extremely low latency is the ability to avoid imposing the recovery of old data on every newer update.
That does not mean every arriving datagram is safe to apply. The application may need identifiers, ordering information, deadlines and verification of the sender’s identity. With deltas, it may need to hold later updates until a gap is repaired, or resynchronise when a deadline expires. An application can also add the selective retransmission it actually needs on top of UDP.
The extra freedom creates additional design responsibilities. Increasing the sending rate can make congestion, loss and delay worse. A full receive buffer, slow reconstruction or slow decoding can prevent decisions even when packets arrive early. Decoding means reading the received data into a form the application can use. UDP applications still need control of sending volume and timing (rate control), along with a response to congestion. [6]

4. QUIC in the UDP family: what it adds and which waits it separates

QUIC is a transport built on UDP and integrates TLS 1.3 for key establishment and protection. Using UDP underneath and offering unreliable delivery to an application are different choices. [7] [8]
One QUIC connection can contain multiple Streams. Ordinary Streams provide reliable, ordered byte delivery, with byte ordering maintained separately for each stream. Missing data in Stream A can hold up later data within A. However, data already available in an unrelated Stream B does not have to wait simply because A is missing bytes. Separating independent work into different streams can therefore matter. [7]
QUIC DATAGRAM is a different extension. It can be used when the peer advertises support. QUIC does not retransmit its lost payloads and does not provide ordered delivery for them. A design can place information that requires reliable delivery on Streams and information whose value declines after a deadline in DATAGRAMs within an encrypted connection. [9]

Figure 2 | Stream and DATAGRAM provide different guarantees within QUIC.

QUIC Streams retransmit necessary data and preserve ordering within each stream. DATAGRAM does not retransmit a lost payload.
Illustrative model. The ordering wait inside Stream A remains; Stream B carries independent data. Streams and DATAGRAM traffic still share connection resources such as bandwidth and congestion control. Receiving a later datagram does not establish that the application may safely use it.
Processing or guaranteeDirect UDPQUIC StreamQUIC DATAGRAM
Connection establishment and stateNot provided by UDP itselfUses a QUIC connectionUses a QUIC connection
Data encryption and authenticationNot provided by UDP itselfProvided by QUICProvided by QUIC
Acknowledgements (ACKs)Not provided by UDP itselfHandled by QUICHandled by QUIC
Payload recovery after lossUDP itself does not retransmitNecessary STREAM data is retransmittedQUIC does not retransmit
Ordered delivery to the applicationNot provided by UDP itselfWithin each StreamNot provided
Flow controlRequired controls designed separatelyStream and connection levelNot subject to Stream flow control
Response to congestionDesigned in the application or another layerQUIC congestion controlQUIC congestion control
QUIC does not resend a lost packet as an identical whole. It sends necessary STREAM data again in new frames. A lost packet containing data from both A and B can affect both streams. Shared congestion and resources also mean that streams are not completely independent in their latency. [7]
Direct UDP can omit QUIC-specific header and frame processing, connection-state management, data encryption and authentication, and ACK and loss tracking from the delivery path. By omitting that additional work, a direct UDP design can target very low latency with less transport processing than QUIC. Required protection and traffic controls still need to be designed in the application or another suitable layer. [5] [7] [8] [6]
QUIC DATAGRAM removes payload retransmission and ordering waits, but retains connections, encryption, ACKs and congestion control. Packets containing DATAGRAM frames elicit acknowledgements; this does not mean the sender waits for the previous ACK before sending each item. An established connection can also be reused without a handshake for every item. Compare initial connection time separately from ongoing delivery work. Congestion control can still delay sending, and a receiver may discard a DATAGRAM it cannot process. [7] [9]
This comparison identifies work and waits that can be omitted. Actual arrival time also depends on the path, load and implementation; adding equivalent protection or recovery to UDP incurs its own cost. Distinguish a comparison under equivalent guarantees from a design that reduces latency by choosing different guarantees.

5. Trace the TCP and UDP families through actual protocol paths

The TCP family places TCP beneath gRPC and WebSocket. The UDP family includes both direct use of UDP and paths that add QUIC above it. Figure 3 traces familiar connections and APIs down to their transport. Identify which layer handles ordering and retransmission, and keep waits in communication separate from waits in processing after reception.
WebSocket is a protocol for exchanging messages in both directions. In the usual HTTP/1.1 setup, an Upgrade handshake establishes the connection, after which WebSocket frames travel over TCP. Each message is not another HTTP/1.1 request. The wss scheme uses TLS protection. [10]
gRPC is an RPC framework. Typical native gRPC carries messages over HTTP/2, with TCP underneath. Protobuf is the standard mechanism for defining types and serialising data; it is not a delivery guarantee. gRPC streaming allows multiple messages to be exchanged through a continuing RPC. [11] [12]

Figure 3 | Trace paths that use TCP and paths built on UDP.

WebSocket, gRPC, HTTP/3, QUIC DATAGRAM and raw UDP are paired with the layers that carry their data.
Representative data paths. HTTP/1.1 on the left is the WebSocket opening procedure, not the continuing data layer. Some security layers, including TLS where applicable, are omitted. QUIC integrates TLS 1.3. The diagram describes protocol relationships, not a claim that ERPC offers every configuration shown.
HTTP/2 uses frames with stream identifiers to separate multiple exchanges into streams on one connection. In the underlying TCP transport, however, data sent in the same direction shares one byte stream. A gap can therefore hold up data for a different HTTP/2 stream that follows it. QUIC manages this ordering separately for each Stream. The scope over which data shares an ordering wait affects when an update becomes usable. [13] [7]
HTTP/2 flow control manages how much data the receiver can accept at both stream and connection level. This is distinct from TCP acknowledgements and network congestion control. [13]
When gRPC reception is slow, inspect decoding, queues and storage after reception as well as HTTP/2 flow control. Enlarging a window does not remove a backlog caused by an application that cannot keep up. The practical details of subscriptions and reception on ERPC are covered in Yellowstone gRPC best practices. [14]
HTTP/3 carries HTTP over QUIC, using reliable streams for ordinary requests and responses. Specifications also exist for starting WebSocket over HTTP/2 and HTTP/3, but they require Extended CONNECT support to be advertised and compatible clients, servers and intermediaries. WebSocket over HTTP/3 uses a single QUIC Stream; it does not become an unreliable DATAGRAM channel. This describes the specifications and does not assert support on ERPC’s individual endpoints. [15] [16] [17]
For a web application, also check where the code runs. Browser APIs are different from a server-side UDP socket or a native gRPC client. gRPC-Web uses a different wire format for browser clients and requires compatible proxy or server handling. One possible design subscribes to gRPC on a server and sends the data needed for display to the browser over WebSocket. If a browser application needs datagrams, check an API such as WebTransport and support in the target browsers and endpoint. The use of HTTP/3 alone does not mean that application code can connect directly to raw UDP or QUIC DATAGRAM. [25] [26]

6. Choose communication properties and application responsibilities per use

An online game does not need to treat position updates and item purchases with the same loss policy. A self-contained current position may replace an older version, while a purchase result and its history need recovery and reconciliation. One application can combine paths with different guarantees.
UseDeadlines, ordering and lossWhat guides the choice
Interactive voice and videoShort playback deadlines; waiting can be avoided within the limits of concealment or recoveryConsider UDP-based media delivery together with codec dependencies and a jitter buffer
Live video for many viewersDefine acceptable viewing delay and interruptions; frames may depend on earlier framesHTTP-based LL-HLS and LL-DASH are also options; live does not automatically mean UDP
Game position updatesComplete states can make newer updates independently usefulConsider datagrams, interpolation and resynchronisation; delta formats still require their base state
Current-value displays and market dataSeparate display values, order-book deltas and trade historyLatest-state selection may suit a display; deltas need gap recovery, while history needs completeness
HTTP APIs and WebSocketIntegrate requests, responses and continuing notifications into existing web applicationsUse the supported API and required guarantees; design resubscription and reconciliation after disconnection
Orders, payments and historyMissing or misapplied events corrupt business state; processing deadlines still matterCombine reliable delivery with business identifiers, idempotency and outcome reconciliation
Audio and video cannot tolerate arbitrary loss. Losing one frame can affect the decoding of later frames. Retransmission, FEC, concealment and buffering are chosen according to playback deadlines and dependencies. HTTP-based low-latency live delivery is another option. [18]
A design can carry Solana Shreds over QUIC. Even so, delivery that prioritises the arrival of raw Shreds and submission that needs a complete transaction can benefit from different guarantees and controls.
Solana communication pathData carriedRequired guarantees and processing
Shreds reception through UDP ForwardingRaw fragments that make up block dataValidate and collect arriving pieces; reconstruct and decode when the required pieces are available
QUIC submission to a TPUSigned transactionsCarry each transaction over a Stream; admission control and execution-result checks also matter
Yellowstone gRPC receptionStructured account, transaction and slot notificationsRequired subscriptions, execution information, commitment (the required level of chain confirmation), continuous reception and resynchronisation
WebSocket receptionUpdates through JSON-RPC subscriptionsNotification meaning and scope, commitment, and state reconciliation after disconnection

Why UDP Forwarding delivers Shreds directly over UDP

ERPC’s UDP Forwarding delivers raw Shreds directly over UDP to a specified public IPv4 address and port. The customer application receives them through a UDP socket and performs the required validation, reconstruction and decoding. The value of direct UDP is to hand Shreds to reception processing as early as possible without adding QUIC processing to the delivery path. The official launch explanation also identifies low overhead as a reason for this delivery model. [1] [33]
If the same Shreds travel through one QUIC Stream, a gap holds up later data within that Stream. Separate Streams narrow the scope of the ordering wait, and QUIC DATAGRAM removes payload retransmission and ordering waits. The connection management, encryption and ACK processing described in Chapter 4 still remain. Direct UDP also omits that additional processing in pursuit of the lowest forwarding latency. The ability to carry data over QUIC and the value of adding QUIC for a particular use are separate judgments. [7] [9]
When one Shred is missing, UDP does not impose a transport ordering-recovery wait on other Shreds that arrive later. The receiver can validate and deduplicate arriving pieces, then reconstruct and decode the portions for which it has enough data. Deciding what to wait for or recover according to the data’s structure connects direct UDP’s lightweight delivery path to faster application processing. [1] [5]
A Shred is not a complete current-state update that always contains everything needed on its own. FEC uses redundant pieces to recover missing data, but requires enough valid, consistent pieces belonging to the relevant FEC set, together with compatible recovery logic. If the required pieces are unavailable, recovery fails. Keeping only the newest Shred is therefore not a valid general design. [19] [20]

Why submit transactions over QUIC?

A signed transaction needs its complete contents delivered. A later, different transaction cannot substitute for missing bytes in the first one. The inspected Agave implementation sends transaction bytes to Solana's TPU, the entry point for transaction reception and processing, by opening a unidirectional QUIC Stream and writing the bytes to it. This uses a reliable Stream that recovers missing data. [23] [32]
A QUIC connection can remain in use while transactions travel over separate Streams. Alongside the per-stream ordering described in Chapter 4, flow control at connection and stream level and congestion control shared by the connection manage traffic. These mechanisms combine reliable delivery of each transaction with control over a continuing flow of submissions. The sending and receiving implementations and their queues also affect when processing advances. [7] [32]
SWQoS, or Stake-weighted Quality of Service, allocates admission resources according to stake and configured trust relationships at the leader, the validator currently responsible for producing blocks. It identifies the peer behind a QUIC connection and determines how that connection is treated. QUIC carries the data; SWQoS controls admission under load. They can work together in the submission path. Neither mechanism guarantees successful transaction execution or chain confirmation. [29] [27]
ERPC's current SWQoS documentation describes an HTTPS entry point for applications. That connection segment is distinct from the onward QUIC path towards validators. ERPC is preparing SWQoS QUIC to develop this submission design further. UDP Shreds reception and QUIC submission apply the same design principle: choose the guarantees required by the data in each direction. [30] [31]

Turn early reception into useful application work

Yellowstone gRPC serves applications that need structured notifications. WebSocket integrates with existing JSON-RPC and web notification logic. The arrival of a raw Shred and the availability of structured information are different processing stages. [2] [21]
Reading a transaction instruction from Shreds does not prove successful execution, a fill, a balance change or the required commitment. An application that needs execution results must check execution information and state through Geyser or RPC. Reception, validation and recovery, application use, and chain confirmation are separate stages. [22]
Consider an illustrative Shreds design for an application that analyses updates from a particular program. If it can correctly reconstruct the required transaction from Shreds and identify its instruction and target market early, it can classify the instruction, select a calculation path and load the market's configuration in advance. This moves preparation that previously began after execution information arrived to an earlier stage. The result is held as a tentative context associated with the transaction signature. [22]

Figure 4 | Prepare from Shreds, then check execution information before reuse.

Shreds allows instruction classification and configuration loading in advance; preparation is used only after checking the execution result, state and required commitment through gRPC or RPC.
An illustrative design. Preparation on the Shreds path must be reversible and is not an executed balance or fill. Identify the transaction by its signature, then separately check the chain context, including its slot, and the consistency of the configuration and state being used. The diagram does not guarantee the feeds’ arrival order or a latency advantage.
When the required execution information and state arrive through gRPC or RPC, the application checks that they concern the same transaction and the intended chain state, and that the loaded configuration remains valid. It reuses the prepared parsing results and configuration when the required commitment and its own conditions for use are satisfied. A signature does not establish commitment, and a slot number alone does not establish a matching state. [21] [27]
If reconstruction fails, the target cannot be identified, matching fails or the preparation expires, the application falls back to its existing execution-information path. It also discards preparation whose assumptions are invalidated by execution failure or a change in chain state. Bound the number and lifetime of these contexts, and compare both the work saved after confirmation and the CPU and memory spent on preparation that was never used.
Shreds Mesh is a delivery design that uses arrivals from multiple paths. It addresses a different problem from UDP’s delivery properties or the receiver’s reconstruction and interpretation. The relationship between first arrival and coverage is explained in the 27 November Shreds Mesh article.

7. UDP reception: handling loss, reordering and duplication

Use the same five updates to make the decision concrete. The initial state is 100. Complete states after each update are 101, 104, 102, 105 and 106. Expressed as deltas, the updates are +1, +3, -2, +3, +1.
Now change the arrival order to 1 → 3 → 3 → 2 → 5. Update 3 arrives twice, update 2 arrives late, and update 4 is not seen during this observation. Compare a receiver carrying complete states with one carrying deltas.

Figure 5 | The same arrival order needs different receiver decisions.

For the same arrival order, a current-state receiver accepts newer states while a delta receiver waits for gaps and applies only contiguous updates.
Illustrative model. The entity and generation are fixed, and authenticity has already been checked. Every current-state update is independently complete. The delta receiver requires contiguous sequence numbers and does not apply data across a gap. Expiry or a buffering limit invokes the recovery policy for that data path.
Incoming updateCurrent-state receiverDelta receiver
1Replace state with 101Apply +1, reaching 101
3Replace state with the complete value 102Hold until 2 arrives; remain at 101
Duplicate 3Discard the duplicateDiscard the duplicate already buffered
Late 2Do not roll state back from version 3Apply 2’s +3, then buffered 3’s -2, reaching 102
5Replace state with the complete value 106Hold until 4 arrives; remain at 102
The delta receiver's retained values of 101 or 102 are the last states it reconstructed correctly. In this example, while a gap is known, they are not used as current state for new decisions. The receiver waits for the required deltas or resynchronisation.
Adding only the deltas from 1, 3, 5 yields 100, rather than the correct state of 106. Choosing the newest arriving number does not restore correctness. Recover update 4, or resynchronise with a trusted complete state whose boundary is explicit, such as “state 106 including all updates through version 5”.
Resynchronisation needs a join point. Establish which updates the complete state includes, then connect the later deltas without gaps or double application. Recovering the current state does not also recover a missing trade-history event.
A sequence gap does not immediately establish permanent loss; packets may simply have been reordered. Define how long and how much to buffer. Check the deadline again before making a decision, because data that was valid on arrival can expire while waiting. Conversely, if only the last update is lost and no later update arrives, sequence numbers alone cannot reveal it. Deadlines, heartbeats and state reconciliation can also be needed to check freshness.
The required mechanisms depend on the application. Use the following as design questions.
MechanismDecision to make
Identity and sequence numbersWhich sender, entity and generation share a sequence space? How are restarts and wraparound distinguished?
Duplicate suppression and gap detectionHow is double application prevented, and what follows a gap: buffering, recovery or resynchronisation?
Deadlines and jitter bufferingHow long may the receiver wait without missing the use deadline?
FEC and recoveryWhich inputs and processing costs are required? What happens if recovery fails or finishes too late?
Congestion and capacitySending rate, pacing, feedback, receive-queue bounds and overload behaviour
MTU and fragmentationWhat size can the path carry? If the application splits data, how are reassembly, expiry and maximum retained data controlled?
Authentication and integrityHow are the sender, tampering and replay checked? A large sequence number is not evidence of trustworthiness
MTU concerns the packet size a path can carry. With IP fragmentation, losing one fragment can prevent reconstruction of the whole packet. Do not assume one fixed size suits every path; account for additional overhead such as tunnels. QUIC DATAGRAM also does not automatically fragment arbitrarily large payloads. [6] [9] [24]
A UDP checksum does not authenticate the sender. Where confidentiality or authentication is required, use established secure protocols and verified mechanisms. A small teaching example of receiver policy is not evidence that an internet-facing server is secure.

8. Identify what is holding up processing before optimising

Select one data path, such as receiving an account change and updating a display, or building the state required for an order decision from order-book deltas. Trace the current code from generation through reception, parsing, validation, state update and the resulting decision.
Then write down the conditions for use. Can a complete new state replace the old one? Are all intermediate deltas required? Can missing history be recovered later? Define the deadline, ordering requirements, duplicate handling and resynchronisation before narrowing the transport choices.
Give the deadline a start and an end, such as update generation to completion of the decision. If generation time cannot be established, do not claim to have verified that deadline. Record the measurable processing interval after reception separately from unverified freshness.

Figure 6 | Choose a transport from the processing goals and data requirements.

Check the latency target and correctness requirements, then compare transports for independent current state, deltas or history, and Shred reconstruction.
This is a decision aid, not a performance ranking. Choose separately for each data path. Keeping the current transport is a valid option when it meets the latency and correctness goals. To pursue lower latency, define that target and compare the benefits and costs of the change.
When investigating waiting, separate delivery from the transport to the application from decoding, queues, storage and state updates after reception. If storage or CPU processing after reception is the cause, changing the transport alone does not remove that wait. If TCP ordering recovery delays the use of independent newer updates, compare whether datagrams can reduce that wait. Evaluate the desired processing latency and the cost of validation, loss handling and recovery, as well as whether deadlines are missed. With QUIC, distinguish independent work on separate Streams from the need for DATAGRAM.
Keep the network conditions, input, message size, processing and requirements such as encryption comparable. Separate connection establishment from steady operation on an existing connection. Raw Shred arrival and availability of execution information through gRPC are different stages of information, so comparing them directly does not isolate transport performance.
The p50 is the median latency; p95 and p99 mark the boundaries of the slowest 5% and 1%. They help examine slow cases that an average can hide, but the set of inputs included in the calculation matters.
MeasureCondition for interpreting it
p50, p95 and p99Fix the interval: generation to arrival, or generation to correct usability. Retain counts excluded from the distribution
Loss rateState whether the unit is a packet, a logical message or a required business event
Success before the deadlineUse predefined required updates or decision points as the denominator, and count those meeting the correctness requirement before the deadline
CPU, memory and bandwidthInclude the same scope of validation, duplicate suppression, FEC, reconstruction and retransmission
CorrectnessCheck expected state under loss, duplication, reordering, expiry, disconnection and resynchronisation
Computing p99 only from delivered data can make a design that discards slow data look better. If every event is required, the intended logical-message set can be the denominator. For latest-state applications, instead define whether each decision point had a sufficiently fresh, correct state within its deadline. Skipping a superseded intermediate update and losing a required historical event should not share an unqualified success criterion.
One-way latency measured with separate clocks requires a synchronisation method and an error estimate. Without that evidence, do not report a definitive one-way latency difference. Measure availability at a common receiver or processing intervals after reception instead. Interpret results alongside the guarantees each design actually provides.
For a local trace, use an existing update ID or assign a local trace ID at receipt. With the same process's monotonic clock, record the receive-callback start (the handoff of a complete message to the application), enqueue, dequeue, validation completion, state application and decision completion for that update. A long interval between enqueue and dequeue means that the message has already reached the application and is waiting for processing to begin. Investigate the queue, CPU work, storage and task scheduling first.

Figure 7 | Observe different waits before and after application receipt.

A TCP ordering wait precedes the shared application-receipt boundary, while a wait to dequeue an update follows it.
An event-order model for designing observations, not measured latency. The upper case correlates the TCP gap and recovery with reads and message handoff on the same connection. The lower case measures enqueue and dequeue for the same update. Source-side delay, TLS, HTTP/2 and runtime scheduling can also precede application receipt; callback timing or retransmission counts alone cannot identify the cause.
To establish the upper case in the figure, inspect a receiver-side TCP trace for the same connection: later bytes are present while an earlier byte range is missing, and contiguous delivery advances when that gap is filled. Correlate this with subsequent reads and the message handoff. This is evidence of an ordering wait for those bytes. To determine how much it contributed to application latency, also separate TLS, HTTP/2, decoding and scheduling. [4] [14]
When adding receiver-side arrival timestamps, record where each timestamp is generated. Linux software receive timestamps, for example, are generated near the handoff from the driver to the kernel receive stack; they are not application-callback timestamps. Do not subtract readings from different clocks without checking their relationship and error. Leave unobserved intervals unresolved, and compare changes using the same inputs and conditions. [28]
In an existing application, start by recording the same update ID at the receive callback, enqueue and dequeue. The following illustrates record fields, not a measured log. C identifies one connection lifetime; R1 and R2 are chunks read from its socket; span is a byte range counted in the same receive direction. M3 identifies a complete framed message and U3 the application update. Record t_… using the same process's monotonic clock.
log
socket_read       conn=C read=R1 span=[a,b)
socket_read       conn=C read=R2 span=[b,c)
message_complete  msg=M3 source_reads=unresolved
app_handoff       msg=M3 update=U3 mono=t_callback
enqueue           update=U3 mono=t_enqueue
dequeue           update=U3 mono=t_dequeue
Reads and messages are not one-to-one. Assembling M3 may involve both R1 and R2, while R2 may also contribute to another message. Record a link such as source_reads={R1,R2} only after establishing it. For gRPC over TLS, filling this field requires instrumentation that records input-to-output mappings through decryption, HTTP/2 stream separation and message assembly. Nearby timestamps alone do not establish a link. [4] [12]
The queue wait for U3 is t_dequeue − t_enqueue; it excludes delays before enqueue. Add lower-layer records where the implementation allows them to be captured. Even if a TCP ordering wait is established for C, its contribution to the delay of U3 remains unresolved until the affected bytes are linked through the reads and M3 to U3.
When choosing a transport, consider together what can be processed without waiting and what the receiver must handle in return. Using independent updates first, recovering required deltas and placing independent work on separate Streams solve different kinds of waiting. Match those mechanisms to the waits observed in the current application to reduce latency while preserving correctness.

Try it locally: one arrival sequence, two receiver policies

The accompanying offline example processes the five updates from Chapter 7 both as complete states and as deltas. It covers normal delivery, loss, delay, reordering, duplication and expiry. It requires no external service connection or API key. It demonstrates receiver semantics under the same input, not network performance.
Predict the result for 1 → 3 → 3 → 2 → 5 before running it. Tracing why the current-state receiver reaches 106 while the delta receiver retains 102 and suspends new decisions shows why receiver rules must match the properties of the data.
Download and extract the offline example, then run it in an environment with a Rust compiler. No additional crates are needed. If Rust is not installed, use the official installation instructions. You can also learn without running the program by comparing the included README and expected output with the table above.
bash
cd examples
rustc --edition=2021 -D warnings state_delivery.rs -o state-delivery
./state-delivery
rustc --edition=2021 -D warnings --test state_delivery.rs -o state-delivery-tests
./state-delivery-tests
For the final update 5 in the main arrival sequence, the output contains snapshot=Applied([5]) usable=Some((5, 106)) and delta=Held(5) usable=None. Here, None means that the receiver cannot provide a state for a new decision. After resynchronisation, the delta receiver also reaches 106. Compare the full output with the included expected-output.txt.
The example uses a shared simulated clock. Its numbers are neither operational recommendations nor measured milliseconds. It models a single entity and generation, and does not implement encryption, FEC or a production receiver. Its epoch is an input-generation identifier, not an implementation of Solana epochs, forks or commitment. It assumes duplicate sequence numbers carry the same content and the clock never moves backwards.
Resynchronising when a delta expires is the recovery policy chosen for this model. An operational design may instead use delayed deltas as recovery inputs to catch up to a new state, but must separately verify when that state is safe for decisions. The accompanying README specifies its execution conditions and boundaries.
Use one instruction for the task at hand: A for the initial diagnosis, B for a UDP adoption decision, C for receiver correctness, or D for a performance comparison.

Copyable AI instruction A: diagnose the current communication path

text
Diagnose this repository's current communication path within the existing read and local-verification permissions.
First read the formal repository instructions, current code, configuration, dependencies and current official service documentation. Do not retrieve secret values or include them in reports.

Choose one data path and trace generation, sending, reception, decoding, validation, queues, state updates and decisions. Distinguish TCP/UDP/QUIC from upper layers such as HTTP, WebSocket and gRPC.
Establish whether the data is a complete current state, a delta or history, and identify deadlines, ordering, duplicates, gaps, disconnection, resynchronisation and required commitment from the code and requirements. Separate assumptions from verified facts.

Do not propose a transport change until an actual problem is established. If the aim is lower latency, include the measured gap from the agreed new target in the diagnosis. Separate source delay, path delay, flow control and processing after reception. Identify failure conditions that would break correctness.
If a change is needed, state where it applies and where it does not. Plan before-and-after comparisons with the same input, load and guarantees. Include p50/p95/p99, success before the deadline and its denominator, loss, CPU, memory and bandwidth. Do not invent unmeasured results.
Do not change production configuration, publish, enter contracts, incur charges, execute real trades or send secrets externally. Report the supporting code locations, observations, unknowns and smallest useful next action.

Copyable AI instruction B: decide whether UDP belongs in the design

text
Evaluate whether this TCP/WebSocket/gRPC application should introduce UDP or QUIC DATAGRAM, within existing permissions.
First inspect formal instructions, current code, the actual underlying transport, dependency versions and currently supported service features. Distinguish QUIC Streams from DATAGRAM, and do not infer service support from a specification's existence.

For each data path, identify its deadline, whether it carries complete state, deltas or history, tolerable loss and reordering, duplicate suppression, recovery, resynchronisation and required commitment. Evaluate encryption, authentication, replay protection, congestion control, MTU, bounded receive queues and operational cost.
State why adoption is unsuitable where discarding data would corrupt state, recovery is unavailable, post-reception processing is the main bottleneck, or the service or client lacks support.

Only create a design proposal, within existing authority, for paths where evidence supports UDP. Identify the layer responsible for every required guarantee and the behaviour on failure: stop, hold, recover or resynchronise.
Plan comparison with the existing path using identical input, network conditions, message sizes, encryption requirements and processing. Compare correctness, p50/p95/p99, success before the deadline and its denominator, loss, CPU, memory and bandwidth. Do not combine different guarantees into one speed ranking.
Do not change production configuration, publish, enter contracts, incur charges or execute real trades. Do not output secrets. Separate measurement from inference, and completed work from proposed work.

Copyable AI instruction C: verify correctness of real-time data

text
Read the existing real-time receiver and verify data correctness using local checks within existing permissions.
First inspect formal instructions, the data contract, identifiers, entity/sender/generation boundaries, sequence numbers, deadlines, state synchronisation and recovery after disconnection. Establish from code and requirements whether the data is complete current state, deltas or history.

Use the same logical input and expected state to reproduce normal delivery, loss, delay, reordering, duplication and expiry. Where relevant, include expiry during buffering, sequence reuse or generation changes, and buffer limits.
Check for rollback to older state, applying deltas across gaps, double application, hidden loss of required history, and gaps at the resynchronisation join point. Do not confuse successful business processing with a transport ACK.
Identify the conditions that preserve the guarantees and the failures that require stopping, holding, recovery or resynchronisation. If no defect is found, do not make unnecessary implementation changes.

Limit any authorised fix to the permitted local scope and compare before and after with the same input and guarantees. Alongside correctness, record processing time, success before the deadline and its denominator, and retained data. Do not generalise finite-input results into production performance.
Do not change production configuration, publish, enter contracts, incur charges, execute real trades or send to real users. Do not handle secret values. Preserve reproduction steps, expected and actual results, and unverified conditions.

Copyable AI instruction D: compare communication under equal conditions

text
Design a communication-performance comparison within existing read and local-verification permissions, and execute only the permitted parts.
First inspect formal instructions, current code, dependency versions, transports and upper-layer protocols, data contracts and supported endpoint features. List each candidate's delivery, ordering, recovery, encryption and business-correctness guarantees. State applicability and failure conditions.

Use identical logical input, data volume, message sizes, network path/load/loss conditions, CPU placement and processing. Separate connection establishment from steady operation. Include equivalent validation, reconstruction, decoding, retransmission and queue costs.
Measure before and after: p50/p95/p99, loss rate, arrival before the deadline, correct usability before the deadline, CPU, memory and bandwidth. Distinguish logical-message and packet denominators. Do not improve the apparent result by excluding missing, late or unrecoverable items.
For latest-state use, evaluate freshness and correctness at each decision point; for history, evaluate recovery of every required event. Record clock synchronisation and its error for one-way latency. Without that evidence, do not claim definitive one-way values.

Verify correctness with the same input, and do not reduce results with different guarantees to a single speed ranking. Retaining the current design is a valid conclusion when no advantage is demonstrated.
Do not load-test production, change production configuration, publish, enter contracts, incur charges or execute real trades. Do not make unauthorised connections or output secrets. Mark unavailable measurements as unperformed and report procedures, raw results, environment, versions and limits of applicability.

References

Specifications and product documents were checked on 28 November 2026. The diagrams and five-update example are illustrative models. This article does not report a measured TCP/UDP/QUIC ranking, new ERPC latency differences or packet-loss rates.