Skip to content

why no HTTP keep-alive #768

Description

@NayanEupho

Right now every single chat prompt as a completely isolated event. When you type a message and press enter, the app dynamically allocates a random, short-lived port on your computer (like 59032) to talk to Ollama (port 11434). It initiates a full TCP three-way handshake to open a channel, streams the AI's response, and then immediately kills the connection.

For your very next message, it has to throw away that socket, allocate a brand new port (like 59038), and perform the entire handshake ceremony all over again. This constant cycle of opening, tearing down, and cleaning up network sockets is known as connection churning.

A persistent HTTP connection (HTTP keep-alive) could easily solve this by reserving a port and keeping the connection open between message turns in a chat session.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions