pingcap/tidb

Support SO_REUSEPORT

Open

#13,808 opened on 2019年11月28日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)Go (40,090 stars) (6,186 forks)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:

コントリビューターガイド