A new end point to get resource group stats#14177
Conversation
227728a to
8cc1509
Compare
|
A couple of high level questions:
|
The end point returns all the stats for a resource group and all it's subtrees. I am open to name it differently.
The new endpoint returns a ResourceGroupInfo. ResourceGroupInfo contains a list of ResourceGroupInfo's as its subtrees. ResourceGroupInfo consists of basic stats (running and queued query counts) and actual queries as strings. This method leaves the queries empty since it is not needed.
Good question. The load balancer will call this method with a root group id. It will return everything under that resource group as a ResourceGroupInfo. I think this is the bulk status you are asking. CC: @mayankgarg1990 |
8871f8e to
023a506
Compare
presto-main/src/main/java/com/facebook/presto/server/ResourceGroupStateInfoResource.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...-spi/src/main/java/com/facebook/presto/spi/resourceGroups/ResourceGroupSelectionContext.java
Outdated
Show resolved
Hide resolved
presto-spi/src/main/java/com/facebook/presto/spi/resourceGroups/SelectionContext.java
Outdated
Show resolved
Hide resolved
presto-spi/src/main/java/com/facebook/presto/spi/resourceGroups/SelectionContext.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...group-managers/src/main/java/com/facebook/presto/resourceGroups/ResourceGroupIdTemplate.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Coudn't understand the logic here, how are we deciding if a subgroup is static vs dynamic. can you explain the logic here?
There was a problem hiding this comment.
resourceGroupSelectionContext is holding the dynamic segment index.
For example:
abc_static.xyx_static.qwe_dynamic.sdq_static.
dynamic segment index is 2.
id.segment.size() is giving the size of the parent. This is also the index of the subgroup. so if parent.segment.size == dynamic segment index than the sub groups is dynamic.
731665a to
cabda69
Compare
shixuan-fan
left a comment
There was a problem hiding this comment.
I don't have much background/context about resource group so my review is very limited :(
How about changing the commit title to: Introduce end point to get static resource group info?
There was a problem hiding this comment.
Why is this true? Sorry I don't have much background about resource group.
There was a problem hiding this comment.
I guess the root resource group is always static
arhimondr
left a comment
There was a problem hiding this comment.
I'm not an expert in this codebase. But from what I understand the new method should return the resource group information in form of a tree without including the information about running queries and without including the information about dynamically generated subgroups. The extra information about queries and dynamic subgroups is not included to keep the responses short.
Currently there's already a method that returns resource group information that includes detailed query information and a high level summary for the subgroups.
I wonder if these two methods should be merge together by introducing additional parameters. I don't have a strong opinion about this, and would love to hear what others think.
presto-main/src/main/java/com/facebook/presto/server/ResourceGroupStateInfoResource.java
Outdated
Show resolved
Hide resolved
presto-spi/src/main/java/com/facebook/presto/spi/resourceGroups/SelectionContext.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/server/ResourceGroupInfo.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I guess the root resource group is always static
cabda69 to
790fa60
Compare
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
i think this logic works to identify the given resource group is static or not. But a much cleaner way would be, if we mark each segment of ResourceGroupId being static or not when we create them via group.expandTemplate call, then we can easily put the flag here. And no need to rely on the context.
i.e. this line will become something like this
group = parent.getOrCreateSubGroup(id.getLastSegment().getValue(), id.getLastSegment().isStatic());
And i think to make this happen, we may need to change the segments in ResourceGroupId class from string to a class Segment which looks like this:
class Segment {
String value;
String isStatic;
}
There was a problem hiding this comment.
We had a offline chat with @swapsmagic. We concluded that introducing a segment class would require a major code change. We are going to keep it as is.
presto-main/src/main/java/com/facebook/presto/server/ResourceGroupStateInfoResource.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
A load balancer can use resource group level stats to do better load balancing. The new endpoint returns a ResourceGroupInfo. ResourceGroupInfo contains a list of ResourceGroupInfo's as its subtrees. ResourceGroupInfo consists of basic stats (running and queued query counts) and actual queries as strings. This method leaves the queries empty since it is not needed. The end method does not return the dynamically generated the resource groups.
790fa60 to
750ac90
Compare
swapsmagic
left a comment
There was a problem hiding this comment.
few naming related comment, rest looks good.
| } | ||
|
|
||
| public InternalResourceGroup getOrCreateSubGroup(String name) | ||
| public InternalResourceGroup getOrCreateSubGroup(String name, boolean staticSegment) |
There was a problem hiding this comment.
i think this should have been named as staticSubGroup
|
|
||
| @Override | ||
| public ResourceGroupInfo getResourceGroupInfo(ResourceGroupId id) | ||
| public ResourceGroupInfo getResourceGroupInfo(ResourceGroupId id, boolean includeQueryInfo, boolean summarizeSubgroups, boolean includeStaticSubgroupsOnly) |
There was a problem hiding this comment.
summarizeSubgroups should be summarizeSubGroups to make it true camel case.

A load balancer can use resource group level stats to do better
load balancing. The new endpoint returns a ResourceGroupInfo.
ResourceGroupInfo contains a list of ResourceGroupInfo's as its subtrees.
ResourceGroupInfo consists of basic stats (running and queued query counts)
and actual queries as strings. This method leaves the queries empty
since it is not needed. The end method does not return the dynamically
generated the resource groups.