Skip to content

【Q144】http 1.1 中的 keep-alive 有什么作用 #145

@shfshanyue

Description

@shfshanyue
Owner
No description provided.

Activity

shfshanyue

shfshanyue commented on Dec 24, 2019

@shfshanyue
OwnerAuthor

http 1.1 中,在响应头中设置 keep-alive 可以在一个 TCP 连接上发送多个 http 请求

  1. 避免了重开 TCP 连接的开销
  2. 避免了刷新时重新建立 SSL 连接的开销
  3. 避免了QPS过大时,服务器的连接数过大

在服务器端使用响应头开启 keep-alive

Connection: Keep-Alive
Keep-Alive: timeout=5, max=1000
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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @shfshanyue

        Issue actions

          【Q144】http 1.1 中的 keep-alive 有什么作用 · Issue #145 · shfshanyue/Daily-Question