---
date: '2022-07-01'
description: tcp optimization algorithms that maximize data-to-packet ratio by buffering small packets, including nagle's algorithm and delay ack mechanisms.
id: Nagle and TCP Cork
modified: 2026-06-05 15:08:20 GMT-04:00
tags:
  - seed
  - networking
title: Nagle's algorithm and TCP_CORK
created: '2022-07-01'
published: '2022-07-01'
pageLayout: default
slug: thoughts/Nagle-and-TCP-Cork
permalink: https://aarnphm.xyz/thoughts/Nagle-and-TCP-Cork.md
generator:
  quartz: v4.6.0
  hostedProvider: Cloudflare
  baseUrl: aarnphm.xyz
full: https://aarnphm.xyz/llms-full.txt
---
## Nagle’s algorithm and Delay ACK

- _small packets_ <span>&rarr;</span> not for TCP <span>&rarr;</span> Nagle algorithm: `Maximize ratio of packets - data content` <span>&rarr;</span> Delay ACK: `silly window`

```prolog
if available_data & window_size > MSS
	send payload on wire
else
	if unconfirmed_data
		queue
	else
		send
```

## CORK algorithm

