Add a property to limit user instance num.#6159
Conversation
| !Strings.isNullOrEmpty(queryInfo.getConnectContext().getQualifiedUser()) | ||
| ) { | ||
| String user = queryInfo.getConnectContext().getQualifiedUser(); | ||
| long maxQueryInstances = queryInfo.getConnectContext().getCatalog().getAuth().getMaxQueryInstances(user); |
There was a problem hiding this comment.
maxQueryInstances can be saved in ConnectionContext when connection established, so that no need to calculate this variables at every registerInstances()
There was a problem hiding this comment.
If save maxQueryInstances in ConnectionContext , we can not change it after ConnectionContext created.
getMaxQueryInstances will try to obtain an read lock in PlaoAuth. I think the cost should be very small, because it is a situation of reading more and writing less.
However, we can update parameters and disconnect all links to make parameters take effect.
There was a problem hiding this comment.
I made a test, in high concurrency scenarios, QPS has a drop of about 10% (from 11000/s to 10000/s)
But I think its OK for most cases.
|
|
||
| private long maxConn = 100; | ||
|
|
||
| private long maxQueryInstances = -1; |
There was a problem hiding this comment.
We can create a new class and put all user property in it. And using json to serialize it. So that we don't need to update the meta version each time we add a new property in future.
1e34672 to
307c47f
Compare
Proposed changes
Add a property to limit user instance num.
Types of changes
What types of changes does your code introduce to Doris?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments