[TIL] HTTP : The Definitive Guide "p80 ~ p81"

시윤·2024년 3월 8일
0

[TIL] Two Pages Per Day

목록 보기
34/108
post-thumbnail

Chapter 4. Connection Management

(해석 또는 이해가 잘못된 부분이 있다면 댓글로 편하게 알려주세요.)


❤️ 원문 번역 ❤️

TCP Performance Considerations

Because HTTP is layered directly on TCP, the performance of HTTP transactions depends critically on the performance of the underlying TCP plumbing. This section highlights some significant performance considerations of these TCP connections. By understanding some of the basic performance characteristics of TCP, you’ll better appreciate HTTP’s connection optimization features, and you’ll be able to design and implement higher-performance HTTP applications.

  • HTTP 트랜잭션의 성능은 내부의 TCP 연결의 성능에 따라 크게 좌우됩니다. HTTP가 TCP 위에 직접 올라가기 때문입니다.

  • 이번 섹션은 TCP 연결에서의 몇 가지 주요한 성능 고려사항에 주목합니다.

  • 기본적인 TCP의 성능 특성을 이해함으로써 여러분은 HTTP 연결의 최적화 기능을 더 잘 이해할 수 있고, 더 높은 성능의 HTTP 응용 프로그램을 설계하고 구현할 수 있을 겁니다.

This section requires some understanding of the internal details of the TCP protocol. If you are not interested in (or are comfortable with) the details of TCP performance considerations, feel free to skip ahead to “HTTP Connection Handling.” Because TCP is a complex topic, we can provide only a brief overview of TCP performance here. Refer to the section “For More Information” at the end of this chapter for a list of excellent TCP references.

  • 이번 섹션은 TCP 프로토콜의 세부적인 내용을 이해하는 것이 필요합니다.

  • 만약 여러분이 자세한 TCP 성능 고려사항에 크게 관심이 없거나 이미 잘 알고 있다면, "HTTP Connection Handling" 섹션으로 바로 넘어가도 무방합니다.

  • TCP는 매우 복잡한 주제이므로 지금은 TCP 성능에 관한 간단한 요약만 제공할 수 있습니다.

  • TCP에 관한 훌륭한 자료들은 해당 챕터 마지막의 "For More Information" 섹션에 정리되어 있으니 참고 바랍니다.


HTTP Transaction Delays

Let’s start our TCP performance tour by reviewing what networking delays occur in the course of an HTTP request. Figure 4-7 depicts the major connect, transfer, and processing delays for an HTTP transaction.

  • HTTP 요청 과정에서 어떤 네트워킹 지연이 발생하는지 검토해보며 TCP 성능을 이해하기 위한 여정을 시작해봅시다.

  • Figure 4-7은 HTTP 트랜잭션에서 주로 나타나는 연결 지연, 전송 지연, 처리 지연을 나타낸 것입니다.

Notice that the transaction processing time can be quite small compared to the time required to set up TCP connections and transfer the request and response messages. Unless the client or server is overloaded or executing complex dynamic resources, most HTTP delays are caused by TCP network delays.

  • 트랜잭션의 처리 시간은 TCP 연결을 설정하고 요청과 응답 메시지를 주고받는 데 소요되는 시간에 비해 상당히 짧을 수 있습니다.

  • 클라이언트나 서버가 과부하에 걸리거나 복잡한 동적 리소스를 실행하지 않는 한 대부분의 HTTP 지연은 TCP 네트워크 지연에 의해 발생합니다.

There are several possible causes of delay in an HTTP transaction:

  1. A client first needs to determine the IP address and port number of the web server from the URI. If the hostname in the URI was not recently visited, it may take tens of seconds to convert the hostname from a URI into an IP address using the DNS resolution infrastructure.*
  1. Next, the client sends a TCP connection request to the server and waits for the server to send back a connection acceptance reply. Connection setup delay occurs for every new TCP connection. This usually takes at most a second or two, but it can add up quickly when hundreds of HTTP transactions are made.
  1. Once the connection is established, the client sends the HTTP request over the newly established TCP pipe. The web server reads the request message from the TCP connection as the data arrives and processes the request. It takes time for the request message to travel over the Internet and get processed by the server.
  1. The web server then writes back the HTTP response, which also takes time.
  • HTTP 트랜잭션에서 발생 가능한 몇 가지 지연 요인들이 있습니다.

    1. 클라이언트는 가장 먼저 URI로부터 웹 서버의 IP 주소와 포트 번호를 결정해야 합니다. 만약 URI의 호스트에 최근에 방문하지 않았다면, DNS를 사용하여 호스트명을 IP 주소로 변환하는 데 수십 초가 소요될 수 있습니다.
    1. 다음으로 클라이언트는 서버에게 TCP 연결을 요청하고, 서버로부터 연결 승인 응답을 기다립니다. 연결 설정 지연은 TCP 연결이 새로 이루어질 때마다 발생합니다. 일반적으로는 최대 1~2초 정도 걸리지만 HTTP 수백 개의 트랜잭션이 생성되면 빠르게 누적될 수 있습니다.
    1. 연결 설정이 이루어지고 나면 클라이언트는 새로 생성된 TCP 파이프를 통해 HTTP 요청을 전송합니다. 웹 서버는 데이터가 도착했을 때 TCP로 전달된 요청 메시지를 읽고 그것을 처리합니다. 요청 메시지가 인터넷을 따라 움직이고 서버에 의해 처리되는 데 시간이 소요됩니다.
    1. 웹 서버는 HTTP 응답을 작성한 후 되돌려 보냅니다. 이 또한 일정 시간이 소요됩니다.

The magnitude of these TCP network delays depends on hardware speed, the load of the network and server, the size of the request and response messages, and the distance between client and server. The delays also are significantly affected by technical intricacies of the TCP protocol.

  • 이와 같은 TCP 네트워크 지연은 하드웨어 속도, 네트워크와 서버의 로딩 시간, 요청과 응답 메시지의 크기, 클라이언트와 서버 사이의 거리 등에 영향을 받습니다.

  • 또한 TCP 프로토콜의 기술적 복잡도까지도 지연 시간에 큰 영향을 끼칩니다.


Performance Focus Areas

The remainder of this section outlines some of the most common TCP-related delays affecting HTTP programmers, including the causes and performance impacts of:

• The TCP connection setup handshake
• TCP slow-start congestion control
• Nagle’s algorithm for data aggregation
• TCP’s delayed acknowledgment algorithm for piggybacked acknowledgments
• TIME_WAIT delays and port exhaustion

  • 이번 섹션의 나머지 부분은 HTTP 개발자에게 영향을 끼치는 가장 흔한 TCP 지연들의 원인과 성능적인 영향을 요약하고 있습니다.
    - TCP 연결 설정 핸드쉐이크
    - TCP의 Slow-start 혼잡 제어
    - Nagle의 데이터 집계 알고리즘
    - piggybacking을 통한 TCP의 Delayed Acknowledgment 알고리즘
    - TIME_WAIT 지연과 포트 소진

If you are writing high-performance HTTP software, you should understand each of these factors. If you don’t need this level of performance optimization, feel free to skip ahead.

  • 만약 여러분이 고성능의 HTTP 소프트웨어를 작성하고자 한다면 각각의 요인들을 이해해야 합니다.

  • 이러한 수준의 성능 최적화가 필요하지 않다면 언제든 건너뛰어도 좋습니다.


🧡 요약 정리 🧡

HTTP Transaction Delays

  • DNS 변환에 의한 지연
  • TCP 연결 설정에 의한 지연
  • 요청 처리 지연
  • 응답 작성 지연

TCP Delays

  • TCP 연결 핸드쉐이크 지연
  • Slow Start에 의한 지연
  • Nagle 데이터 집계 알고리즘에 의한 지연
  • Delayed Acknowledgment 알고리즘에 의한 지연 (Piggybacking)
  • TIME_WAIT과 포트 소진에 의한 지연

💛 감상 💛

  • 오늘은 왠지 서론만 읽은 기분이다. 전문적이고 자세한 내용은 아마 다음 페이지부터 등장할 것 같다. 저자가 자꾸 심화된 내용이라고 은근히 겁을 주는데, 나는 내용이 쉽든 어렵든 무식하게 2페이지씩 읽는 걸로만 코딩되어 있다. 그리고 원래 무식하면 용감하다. 다음 페이지도 달달한 음료수나 마시며 편안한 마음으로 읽어보겠다.
profile
맑은 눈의 다람쥐

0개의 댓글

관련 채용 정보