Skip to content

Conversation

Lukasa
Copy link
Collaborator

@Lukasa Lukasa commented Sep 8, 2025

Motivation

This patch adds support for HTTP/1 connection pre-warming. This allows the user to request that the HTTP/1 connection pool create and maintain extra connections, above-and-beyond those strictly needed to run the pool. This pool can be used to absorb small spikes in request traffic without increasing latency to account for connection creation.

Modifications

  • Added new configuration properties for pre-warmed connections.
  • Amended the HTTP/1 state machine to create new connections where necessary.
  • Added state machine tests.

Results

Pre-warmed connections are available.

@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Sep 8, 2025
Motivation

This patch adds support for HTTP/1 connection pre-warming. This allows
the user to request that the HTTP/1 connection pool create and maintain
extra connections, above-and-beyond those strictly needed to run the
pool. This pool can be used to absorb small spikes in request traffic
without increasing latency to account for connection creation.

Modifications

- Added new configuration properties for pre-warmed connections.
- Amended the HTTP/1 state machine to create new connections where
    necessary.
- Added state machine tests.

Results

Pre-warmed connections are available.
@Lukasa Lukasa force-pushed the cb-minimum-pool-size branch from 0120933 to d2a4dcc Compare September 8, 2025 10:26
let newConnectionID = self.connections.createNewConnection(on: connectionToClose.eventLoop)
connectionAction = .closeConnectionAndCreateConnection(
closeConnection: connectionToClose,
isShutdown: .no,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I can see this is always no. Therefore we should likely remove it.

close: Connection,
newConnectionID: Connection.ID,
on: EventLoop,
isShutdown: StateMachine.ConnectionAction.IsShutdown
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned elsewhere we don't need this one here.

@Lukasa
Copy link
Collaborator Author

Lukasa commented Sep 8, 2025

Ok, feedback addressed.

Copy link
Member

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good! Thanks!

@Lukasa Lukasa merged commit 7dc119c into swift-server:main Sep 9, 2025
30 checks passed
@Lukasa Lukasa deleted the cb-minimum-pool-size branch September 9, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants