Add option to load project cache at server startup
In installations with large numbers of projects, it may take a long time to populate the cache. Allow the option of concurrently loading the project cache during server startup. Test result: - 5700 projects - Using 40 cpus Without this change, loading the cache takes about 2 minutes. With this change, loading the cache takes a few seconds. Change-Id: Ic05cc8b88ee4c4bf6f5028d3f4dec1e32872aef5
This commit is contained in:
committed by
David Pursehouse
parent
d06ba15d46
commit
fc19ff1899
@@ -18,9 +18,11 @@ import com.google.common.base.Throwables;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.cache.CacheModule;
|
||||
import com.google.gerrit.server.project.ProjectCacheWarmer;
|
||||
import com.google.gerrit.server.config.AllProjectsName;
|
||||
import com.google.gerrit.server.config.AllUsersName;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
@@ -29,6 +31,7 @@ import com.google.inject.Inject;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Singleton;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.google.inject.internal.UniqueAnnotations;
|
||||
import com.google.inject.name.Named;
|
||||
|
||||
import org.eclipse.jgit.errors.RepositoryNotFoundException;
|
||||
@@ -70,6 +73,9 @@ public class ProjectCacheImpl implements ProjectCache {
|
||||
|
||||
bind(ProjectCacheImpl.class);
|
||||
bind(ProjectCache.class).to(ProjectCacheImpl.class);
|
||||
bind(LifecycleListener.class)
|
||||
.annotatedWith(UniqueAnnotations.create())
|
||||
.to(ProjectCacheWarmer.class);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user