Skip to content

XSI-1706/CP-51295: limit open TCP connections to 250 and increase soc… #5953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

edwintorok
Copy link
Contributor

…ket backlog

The default limit of 800 external TCP connections still leads to EMFILE for authenticated users.

Due to the use of Unix.select/Thread.wait_timed_read we cannot increase the file descriptor limit beyond 1024 currently.

We can assume that each API call needs at least 4 file descriptors:

  • 1 for the TCP connection that received the API call
  • another for system calls, or talking to member hosts
  • SMAPIv1 will also require at least one connection back to XAPI, which will needs its own thread, and at least 1 file descriptor to perform certain operations

An API call could of course need more file descriptors than these, the real solution is to move to poll(2)/epoll(2) which doesn't have the 1024 limit that select(2) does.

However meanwhile this prevents problems that users have reported.

The downside is that users may now get client-side TCP errors if they open too many connections, but that is better than causing errors on unrelated API calls. To compensate increase the socket backlog from the default 128.

Due to the old kernel that Dom0 runs this will also require changing 'somaxconn' in /etc/sysctl.d/90-dom0.conf, but this is not controlled by XAPI.

…ket backlog

The default limit of 800 external TCP connections still leads to EMFILE for
authenticated users.

Due to the use of Unix.select/Thread.wait_timed_read we cannot increase the file descriptor
limit beyond 1024 currently.

We can assume that each API call needs at least 4 file descriptors:
  * 1 for the TCP connection that received the API call
  * another for system calls, or talking to member hosts
  * SMAPIv1 will also require at least one connection back to XAPI, which will needs its own thread,
  and at least 1 file descriptor to perform certain operations

An API call could of course need more file descriptors than these, the real solution
is to move to poll(2)/epoll(2) which doesn't have the 1024 limit that select(2) does.

However meanwhile this prevents problems that users have reported.

The downside is that users may now get client-side TCP errors if they open too many connections,
but that is better than causing errors on unrelated API calls.
To compensate increase the socket backlog from the default 128.

Due to the old kernel that Dom0 runs this will also require changing 'somaxconn' in
/etc/sysctl.d/90-dom0.conf, but this is not controlled by XAPI.

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
@edwintorok
Copy link
Contributor Author

(I don't have a build environment for Yangtze at hand, so I haven't tested this change yet. It probably also wants 1 or 2 kernel sysctl changes to make it safer, but that will be done in another package, not the toolstack)

@lindig lindig merged commit af7b9c4 into xapi-project:1.249-lcm Aug 28, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants