Skip to content

Commit

Permalink
Paginate persisted cluster state (#78875)
Browse files Browse the repository at this point in the history
Today we allocate a contiguous chunk of memory for the global metadata
each time we write it to disk. The size of this chunk is unbounded and
in practice it can be pretty large. This commit splits the metadata
document up into pages (1MB by default) that are streamed to disk at
write time, bounding the memory usage of cluster state persistence.
Since the memory usage is now bounded we can allocate a single buffer up
front and re-use it for every write.
  • Loading branch information
DaveCTurner committed Jan 4, 2022
1 parent ec57fbe commit 641a01b
Show file tree
Hide file tree
Showing 14 changed files with 615 additions and 530 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.core.Tuple;
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.NodeEnvironment;
Expand Down Expand Up @@ -112,7 +111,6 @@ public static PersistedClusterStateService createPersistedClusterStateService(Se
dataPaths,
nodeId,
namedXContentRegistry,
BigArrays.NON_RECYCLING_INSTANCE,
new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS),
() -> 0L
);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public void apply(Settings value, Settings current, Settings previous) {
GatewayService.RECOVER_AFTER_DATA_NODES_SETTING,
GatewayService.RECOVER_AFTER_TIME_SETTING,
PersistedClusterStateService.SLOW_WRITE_LOGGING_THRESHOLD,
PersistedClusterStateService.DOCUMENT_PAGE_SIZE,
NetworkModule.HTTP_DEFAULT_TYPE_SETTING,
NetworkModule.TRANSPORT_DEFAULT_TYPE_SETTING,
NetworkModule.HTTP_TYPE_SETTING,
Expand Down

0 comments on commit 641a01b

Please sign in to comment.