-
Notifications
You must be signed in to change notification settings - Fork 687
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
Add admin-port to let administrator connect to the server even maxclient number is reached #1120
base: unstable
Are you sure you want to change the base?
Conversation
a1932d5
to
6092230
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1120 +/- ##
============================================
- Coverage 70.83% 70.68% -0.16%
============================================
Files 118 118
Lines 63561 63583 +22
============================================
- Hits 45025 44943 -82
- Misses 18536 18640 +104
|
6092230
to
bccac8c
Compare
/* Limit the number of connections we take at the same time. | ||
* | ||
* Admission control will happen before a client is created and connAccept() | ||
* called, because we don't want to even start transport-level negotiation | ||
* if rejected. */ | ||
if (listLength(server.clients) + getClusterConnectionsCount() >= server.maxclients) { | ||
if (port != server.admin_port && (listLength(server.clients) + getClusterConnectionsCount() >= server.maxclients)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connections from admin-port
can consume clients out of maxclients
, but the eventloop's size is fixed, do we need to make eventloop to be auto resizing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @soloestoy,
Yes, you’re correct—the event loop size is fixed. However, since the port is known only to the administrator and accepts only local connections, we don't anticipate a large number of clients on the port. Additionally, we've reserved 96 extra FDs in the event loop, which I believe should be sufficient to handle the expected client load on the port. ref:
Line 2634 in 9b8a061
server.el = aeCreateEventLoop(server.maxclients + CONFIG_FDSET_INCR); |
That said, I think I overlooked this. Do you think we should track and add a condition for the number of clients connected to the port?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a fixed number and limit the number of admin connections. We don't need to count the admin connections separately. We can just accept connections on the admin port as long as the total number of connections is less than for example server.maxclients + 20
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a check for the number of connections accepted on the port. Currently, it's set to 20, but I believe 10 would be sufficient. Additionally, the event loop size also been updated based on the maximum number of clients accepted on the port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will also need to track admin
clients separately from server.clients
or we are eating into the actual end-user client quote, something like below, assuming server.clients
is the total
if (port != server.admin_port &&
(listLength(server.clients) - listLength(server.admin_clients) + getClusterConnectionsCount() >= server.maxclients))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PingXie Why is that a problem? Do you think clients are surprised they can make fewer connections because an admin is connected?
Or do you think the admins need to be completely invisible to other clients, like not shown in CLIENT LIST, etc.?
I think the admins can be visible and I don't see why it's a problem that a admin eating the users' quota is a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @PingXie, We have fixed the number of admin clients to 20(it can be adjusted) and could not see how it will impact the client quota. As Viktor pointed, do you want to hide admins from end user clients?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At amazon we have a fixed number of clients ontop of what is requested as well (although I believe we chose 256). It's worth mentioning that clusterbus connections also eat into the overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this feature could solve part of this problem in cluster mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we close the discussion at valkey-io/valkey-rfc#3 (comment)?
/* Limit the number of connections we take at the same time. | ||
* | ||
* Admission control will happen before a client is created and connAccept() | ||
* called, because we don't want to even start transport-level negotiation | ||
* if rejected. */ | ||
if (listLength(server.clients) + getClusterConnectionsCount() >= server.maxclients) { | ||
if (port != server.admin_port && (listLength(server.clients) + getClusterConnectionsCount() >= server.maxclients)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will also need to track admin
clients separately from server.clients
or we are eating into the actual end-user client quote, something like below, assuming server.clients
is the total
if (port != server.admin_port &&
(listLength(server.clients) - listLength(server.admin_clients) + getClusterConnectionsCount() >= server.maxclients))
cbea31d
to
55a35c2
Compare
632e9e0
to
e12dc1e
Compare
23e662e
to
66129c6
Compare
08aebb5
to
8ac9019
Compare
8ac9019
to
e94b3f7
Compare
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
1b29430
to
e40f4c2
Compare
It is closed right now. |
Background:
The parameter "maxclient" default value is 10000. Client administrators could set higher value to accept more client connections.
However, there is one situation: If the connection number of client reaches the maxclient, then even administrators have no chance to connect to the server to process some urgent issues or update some configurations.
To solve above case, by connecting to the admin port, an administrator or cloud provider has the chance to connect to the server even the max number of connected clients reaches
Of course, there is one risk by introducing the admin port: hacker has one more chance to invade the Valkey server, but
I think this kind of risky is less than what we thought. Because in standlone mode, primary node could expose ports to multiply replicas and sentinel nodes, and in cluster mode. primary node has port to connect with other nodes. Thus one more port to connect with administrator is not a big issue.