diff --git a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java index 0bf033b73..e07e80710 100644 --- a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java +++ b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java @@ -97,6 +97,10 @@ public EbeanLocalAccess(EbeanServer server, ServerConfig serverConfig, @Nonnull _schemaEvolutionManager = createSchemaEvolutionManager(serverConfig); _nonDollarVirtualColumnsEnabled = nonDollarVirtualColumnsEnabled; validator = buildValidator(server, serverConfig); + // Pre-warm at construction time so the cache is hot before the first request, + // regardless of whether ensureSchemaUpToDate() is called by the service. + validator.registerAndPreWarm(getTableName(_entityType)); + validator.registerAndPreWarm(getTestTableName(_entityType)); } private static SchemaValidatorUtil buildValidator(EbeanServer server, ServerConfig serverConfig) { @@ -135,9 +139,6 @@ public void configureOptionalForceIndex(@Nullable String indexName, public void ensureSchemaUpToDate() { _schemaEvolutionManager.ensureSchemaUpToDate(); - // Pre-warm the shared cache for both the prod and test tables so the first request is never slow. - validator.registerAndPreWarm(getTableName(_entityType)); - validator.registerAndPreWarm(getTestTableName(_entityType)); validateForceIndex(); }