pingcap/tidb

Support SO_REUSEPORT

Open

#13,808 建立於 2019年11月28日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)Go (40,090 star) (6,186 fork)batch import
component/serverfeature/acceptedhelp wantedpriority/P1type/feature-request

描述

Feature Request

Is your feature request related to a problem? Please describe:

Describe the feature you'd like:

Support SO_REUSEPORT for TiDB

After Linux version 3.9, TCP and UDP support for the SO_REUSEPORT socket option; that support was implemented in a series of patches by Tom Herbert. The new socket option allows multiple sockets on the same host to bind to the same port, and is intended to improve the performance of multithreaded network server applications running on top of multicore systems.

Benefits:

  1. For multicore systems, multiple instances of tidb-server can listen to a same port providing service. Here's a picture to demonstrate how it's working. Note that ports of the three instance is the same (4000), but the status port is not the same (for monitoring each instance).
  2. Support graceful upgrading if we have a supervisor process to manage all tidb-server instance in one machine.

Describe alternatives you've considered:

  1. tidb-ansible may need to be modified because it's waiting for the port of tidb-server listening to make sure the process is started. After supporting SO_REUSEPORT, each tidb-server on a same machine may be listening to a same port.

Teachability, Documentation, Adoption, Migration Strategy:

貢獻者指南