Hello, throughout my efficiency stress testing, I configured 128 requests per second. The Go service, operating inside a container allotted with 1 CPU core and 1 GB of reminiscence, exhibited a major delay in the course of the TLS handshake course of. Particularly, the period from receiving the Shopper Hiya to sending the Server Hiya might take so long as six seconds.
tls v1.2
go 1.22
It sounds such as you’re encountering a bottleneck in the course of the TLS handshake course of underneath excessive load. Listed below are some potential areas to research and optimize:
- Useful resource Allocation: With only one CPU core and 1 GB of reminiscence, the container is perhaps struggling to deal with the cryptographic computations required for the TLS handshake. Contemplate growing the allotted assets to see if it reduces the delay.
- TLS Configuration:
- Be sure that the cipher suites getting used are optimized for efficiency. Some cipher suites are extra computationally intensive than others.
- Verify if session resumption (through session tickets or session IDs) is enabled to cut back the overhead of repeated handshakes.
- Concurrency Dealing with:
- Evaluate the Go service’s concurrency mannequin. Be sure that the
GOMAXPROCS
setting is appropriately configured to make the most of the accessible CPU assets successfully. - Examine whether or not the Go runtime’s rubbish assortment or different background duties are inflicting delays.
- Community Latency:
- Confirm that there are not any network-related points contributing to the delay. Instruments like
tcpdump
or Wireshark can assist analyze the handshake course of.
- Profiling and Debugging:
- Use Go’s built-in profiling instruments (e.g.,
pprof
) to establish bottlenecks within the utility. - Allow detailed logging for the TLS handshake to pinpoint the place the delay happens.
- Library and Model Updates:
- Be sure that you’re utilizing the newest steady model of Go (presently 1.22 in your case). If attainable, take a look at with a more recent model to see if the difficulty persists, as there is perhaps efficiency enhancements or bug fixes.
- Exterior Dependencies:
- If the service depends on exterior programs (e.g., a database or API), be sure that they aren’t contributing to the delay.