Class CapacityPlanner
java.lang.Object
com.loomcache.server.metrics.CapacityPlanner
Predicts future resource needs based on historical growth trends.
Estimates capacity exhaustion and recommends scaling actions.
Thread-safe using ReentrantReadWriteLock.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordSnapshot of capacity metrics at a point in time.static enumScaling recommendation action.static final recordScaling recommendation record. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all recorded snapshots.doubleEstimate growth rate in entries per hour based on recent trend.doubleGet current capacity utilization (0.0 to 1.0).intGet number of recorded snapshots.predictCapacityExhaustion(long maxEntries) Predict when capacity will be exhausted.Get scaling recommendation based on current and projected utilization.voidrecordSnapshot(long entryCount, long memoryUsed, long maxMemory) Record a capacity snapshot.
-
Constructor Details
-
CapacityPlanner
public CapacityPlanner()Create a new CapacityPlanner.
-
-
Method Details
-
recordSnapshot
public void recordSnapshot(long entryCount, long memoryUsed, long maxMemory) Record a capacity snapshot.- Parameters:
entryCount- current entry countmemoryUsed- current memory used in bytesmaxMemory- max available memory in bytes
-
estimateGrowthRate
public double estimateGrowthRate()Estimate growth rate in entries per hour based on recent trend.- Returns:
- entries per hour
-
predictCapacityExhaustion
-
recommendScaling
Get scaling recommendation based on current and projected utilization.- Returns:
- scaling recommendation
-
getCurrentUtilization
public double getCurrentUtilization()Get current capacity utilization (0.0 to 1.0).- Returns:
- utilization ratio
-
clear
public void clear()Clear all recorded snapshots. -
getSnapshotCount
public int getSnapshotCount()Get number of recorded snapshots.- Returns:
- snapshot count
-