diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2024-05-29 13:39:33 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-30 07:38:10 +0100 |
| commit | e16d690e777c625f12c2838b6719fa913c159c69 (patch) | |
| tree | ace40ae3b19c12297d54ceea8591b5bbb2aa0310 /bitbake/bin | |
| parent | 76a63bd031d923b0dc97ee34ae2faf595bbb98ae (diff) | |
| download | poky-e16d690e777c625f12c2838b6719fa913c159c69.tar.gz | |
bitbake: hashserv: server: Add support for SO_REUSEPORT
SO_REUSEPORT is a socket option that allows multiple servers to listen
on the same TCP port, and the kernel will automatically load balance the
connections between them. This is particularly helpful for the hash
server since it runs in a single thread. To take advantage of a
multi-core server, multiple servers can be started in parallel with this
option (up to 1 per CPU) and the kernel will load balance between them.
(Bitbake rev: d72d5a7decb489e2af0ebc43cfea0ca3e4353e9b)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
| -rwxr-xr-x | bitbake/bin/bitbake-hashserv | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-hashserv b/bitbake/bin/bitbake-hashserv index 4bfb7abfbc..01503736b9 100755 --- a/bitbake/bin/bitbake-hashserv +++ b/bitbake/bin/bitbake-hashserv | |||
| @@ -125,6 +125,11 @@ The following permissions are supported by the server: | |||
| 125 | default=os.environ.get("HASHSERVER_ADMIN_PASSWORD", None), | 125 | default=os.environ.get("HASHSERVER_ADMIN_PASSWORD", None), |
| 126 | help="Create default admin user with password ADMIN_PASSWORD ($HASHSERVER_ADMIN_PASSWORD)", | 126 | help="Create default admin user with password ADMIN_PASSWORD ($HASHSERVER_ADMIN_PASSWORD)", |
| 127 | ) | 127 | ) |
| 128 | parser.add_argument( | ||
| 129 | "--reuseport", | ||
| 130 | action="store_true", | ||
| 131 | help="Enable SO_REUSEPORT, allowing multiple servers to bind to the same port for load balancing", | ||
| 132 | ) | ||
| 128 | 133 | ||
| 129 | args = parser.parse_args() | 134 | args = parser.parse_args() |
| 130 | 135 | ||
| @@ -132,7 +137,9 @@ The following permissions are supported by the server: | |||
| 132 | 137 | ||
| 133 | level = getattr(logging, args.log.upper(), None) | 138 | level = getattr(logging, args.log.upper(), None) |
| 134 | if not isinstance(level, int): | 139 | if not isinstance(level, int): |
| 135 | raise ValueError("Invalid log level: %s (Try ERROR/WARNING/INFO/DEBUG)" % args.log) | 140 | raise ValueError( |
| 141 | "Invalid log level: %s (Try ERROR/WARNING/INFO/DEBUG)" % args.log | ||
| 142 | ) | ||
| 136 | 143 | ||
| 137 | logger.setLevel(level) | 144 | logger.setLevel(level) |
| 138 | console = logging.StreamHandler() | 145 | console = logging.StreamHandler() |
| @@ -155,6 +162,7 @@ The following permissions are supported by the server: | |||
| 155 | anon_perms=anon_perms, | 162 | anon_perms=anon_perms, |
| 156 | admin_username=args.admin_user, | 163 | admin_username=args.admin_user, |
| 157 | admin_password=args.admin_password, | 164 | admin_password=args.admin_password, |
| 165 | reuseport=args.reuseport, | ||
| 158 | ) | 166 | ) |
| 159 | server.serve_forever() | 167 | server.serve_forever() |
| 160 | return 0 | 168 | return 0 |
