[FLINK-40097][historyserver] Introduce Lazy Loading for HistoryServer#28685
[FLINK-40097][historyserver] Introduce Lazy Loading for HistoryServer#28685chenzihao5 wants to merge 3 commits into
Conversation
|
|
||
| In `LAZY` mode, on-demand fetches use two thread pools: | ||
|
|
||
| * `historyserver.lazy.fetch.executor.common.pool-size` (default: `4`) — The size of the shared thread pool used for routine, background archive fetching. |
There was a problem hiding this comment.
I suggest remove the default value here, because we might forget to sync the documentation when changing default values.
|
|
||
| /** Creates an {@link ArchiveStorage} instance under the given temporary directory. */ | ||
| @FunctionalInterface | ||
| interface ArchiveStorageFactory<T> { |
|
|
||
| /** Creates an {@link ArchiveStorage} instance under the given temporary directory. */ | ||
| @FunctionalInterface | ||
| interface ArchiveStorageFactory<T> { |
| throw new FlinkException("Unsupported archive storage type: " + archiveStorageType); | ||
| } | ||
|
|
||
| Map<String, ArchiveMetaInfo> archiveMetaInfoCache = new HashMap<>(); |
There was a problem hiding this comment.
Is this map thread safe? it's better to check the race condition.
| this.commonFetchExecutor = | ||
| Executors.newFixedThreadPool( | ||
| lazyFetchExecutorCommonPoolSize, | ||
| new ExecutorThreadFactory("HistoryServer-commonFetchExecutor")); | ||
| this.individualFetchExecutor = |
There was a problem hiding this comment.
Where are these two thread pools being shut-down?
|
|
||
| if (!overviewCreated && detailArchives.isEmpty()) { | ||
| archiveMetaInfoCache.remove(jobId); | ||
| throw new RuntimeException("Archive of job " + jobId + " is empty"); |
There was a problem hiding this comment.
This RuntimeException will propagate to the catch (Exception e) block in the scanArchives method. Is this as expected?
|
|
||
| /** Container for the {@link Path} and {@link FileSystem} of a refresh directory. */ | ||
| static class RefreshLocation { | ||
| public static class RefreshLocation { |
There was a problem hiding this comment.
What is the purpose of making these change?
| this.archivePath = archivePath; | ||
| } | ||
|
|
||
| public String getArchiveId() { |
| if (!archiveMetaInfoCache.containsKey(jobId)) { | ||
| archiveMetaInfoCache.put(jobId, new ArchiveMetaInfo(jobId, PENDING, jobArchive)); |
There was a problem hiding this comment.
Is this thread-safe? containsKey + put is not an atomic operation.
I think we should add some comments to declare the thread-safe semantic for archiveMetaInfoCache.
683fc9f to
1339960
Compare
What is the purpose of the change
Introduce a lazy-loading mode that loads archive details on demand, improving archive load times and enhancing the user experience.
Brief change log
historyserver.archive.load.modeto specify the loading mode, supportsEAGER(default) andLAZYhistoryserver.lazy.fetch.executor.common.pool-sizeandhistoryserver.lazy.fetch.executor.individual.pool-sizeto control the loading thread poolPENDING,OVERVIEW_PARSING,OVERVIEW_CREATED,DETAIL_PARSINGin ArchiveEventType.org.apache.flink.runtime.webmonitor.history.AbstractHistoryServerHandler#loadResource.Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?