Perform change update on multiple threads
When multiple changes need to be created or updated for a single push operation they are now inserted into the database by parallel threads, up to the maximum allowed thread count. The current thread is used when the thread pool is already fully in use, falling back to the prior behavior where each concurrent push operation can do its own concurrent database update. The thread pool exists to reduce latency so long as there are sufficient threads available. This helps push times on databases that are high latency, such as database servers that are running on a different machine from the Gerrit server itself, e.g. gerrit.googlesource.com. The new thread pool is disabled by default, limiting the overhead to servers that have good latency with their database, such as using in-process H2 database, or a MySQL or PostgreSQL on the same host. Change-Id: I7d7368cee99a47e3f2ad1e753cc3f7e1c82d37b0
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2012 The Android Open Source Project
|
||||
//
|
||||
// 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.google.gerrit.server.git;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
/**
|
||||
* Marker on the global {@link ListeningExecutorService} used by
|
||||
* {@link ReceiveCommits} to create or replace changes.
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface ChangeUpdateExecutor {
|
||||
}
|
Reference in New Issue
Block a user