-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Disagg Coordinator task limit enforcement
For Disagg Coodinator, each coordinator is doing it's own task limit enforcement and ended up runnig lot more tasks on the cluster than configured. With this change, fixing the behavior so each coordinator get global running task count and then enforce the limit and kill queries which using tasks larger that configured limit.
- Loading branch information
1 parent
8ba44be
commit 2744f0e
Showing
14 changed files
with
252 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...to-main/src/main/java/com/facebook/presto/resourcemanager/ClusterQueryTrackerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.facebook.presto.resourcemanager; | ||
|
||
import com.facebook.drift.client.DriftClient; | ||
import com.facebook.presto.util.PeriodicTaskExecutor; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.annotation.PreDestroy; | ||
import javax.inject.Inject; | ||
|
||
import java.util.concurrent.ScheduledExecutorService; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class ClusterQueryTrackerService | ||
{ | ||
private final DriftClient<ResourceManagerClient> resourceManagerClient; | ||
private final ScheduledExecutorService executorService; | ||
private final long runningTaskCountFetchIntervalMillis; | ||
private AtomicInteger runningTaskCount; | ||
private final PeriodicTaskExecutor runningTaskCountUpdater; | ||
|
||
@Inject | ||
public ClusterQueryTrackerService( | ||
@ForResourceManager DriftClient<ResourceManagerClient> resourceManagerClient, | ||
@ForResourceManager ScheduledExecutorService executorService, | ||
ResourceManagerConfig resourceManagerConfig) | ||
{ | ||
this.resourceManagerClient = requireNonNull(resourceManagerClient, "resourceManagerClient is null"); | ||
this.executorService = requireNonNull(executorService, "executorService is null"); | ||
this.runningTaskCountFetchIntervalMillis = requireNonNull(resourceManagerConfig, "resourceManagerConfig is null").getRunningTaskCountFetchInterval().toMillis(); | ||
this.runningTaskCount = new AtomicInteger(0); | ||
this.runningTaskCountUpdater = new PeriodicTaskExecutor(runningTaskCountFetchIntervalMillis, executorService, () -> updateRunningTaskCount()); | ||
} | ||
|
||
@PostConstruct | ||
public void init() | ||
{ | ||
runningTaskCountUpdater.start(); | ||
} | ||
|
||
@PreDestroy | ||
public void stop() | ||
{ | ||
runningTaskCountUpdater.stop(); | ||
} | ||
|
||
public int getRunningTaskCount() | ||
{ | ||
return runningTaskCount.get(); | ||
} | ||
|
||
private void updateRunningTaskCount() | ||
{ | ||
this.runningTaskCount.set(resourceManagerClient.get().getRunningTaskCount()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.