Package io.debezium.server.redis
Class RedisMemoryThreshold
java.lang.Object
io.debezium.server.redis.RedisMemoryThreshold
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRedisMemoryThreshold(io.debezium.storage.redis.RedisClient client, RedisStreamChangeConsumerConfig config) -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckMemory(long extraMemory, int bufferSize, int bufferFillRate) Redis Enterprise samples the Redis database memory usage in an interval.static StringFormats a raw file size value into a human-readable string with appropriate units (B, KB, MB, GB).private LongvoidsetRedisClient(io.debezium.storage.redis.RedisClient client)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
INFO_MEMORY
- See Also:
-
INFO_MEMORY_SECTION_MAXMEMORY
- See Also:
-
INFO_MEMORY_SECTION_USEDMEMORY
- See Also:
-
accumulatedMemory
private static long accumulatedMemory -
previouslyUsedMemory
private static long previouslyUsedMemory -
totalProcessed
private static long totalProcessed -
client
private io.debezium.storage.redis.RedisClient client -
memoryLimit
private long memoryLimit -
maximumMemory
private long maximumMemory
-
-
Constructor Details
-
RedisMemoryThreshold
public RedisMemoryThreshold(io.debezium.storage.redis.RedisClient client, RedisStreamChangeConsumerConfig config)
-
-
Method Details
-
setRedisClient
public void setRedisClient(io.debezium.storage.redis.RedisClient client) - Parameters:
client-
-
checkMemory
public boolean checkMemory(long extraMemory, int bufferSize, int bufferFillRate) Redis Enterprise samples the Redis database memory usage in an interval. Since the throughput of Redis is very big, it is impossible to rely on delayed memory usage reading to prevent OOM. In order to protect the Redis database and throttle down the sink we have created this mechanism:...- Parameters:
extraMemory- - Estimated size of a single record.bufferSize- - Number of records in a batch.bufferFillRate- - Rate in which memory can be filled.- Returns:
-
memoryTuple
-
parseLong
-
getSizeInHumanReadableFormat
Formats a raw file size value into a human-readable string with appropriate units (B, KB, MB, GB).- Parameters:
size- The size value to be formatted.- Returns:
- A human-readable string representing the file size with units (B, KB, MB, GB).
-