QueryControl qc = graph.getService(QueryControl.class);
ClusterControl cc = graph.getService(ClusterControl.class);
_monitor.beginTask("Collect clusters", IProgressMonitor.UNKNOWN);
- cc.gc(graph, clusterTarget);
+ //cc.gc(graph, clusterTarget);
+ if(clusterTarget == -1) {
+ int used = cc.used();
+ //System.err.println("session gc, cluster use = " + used);
+ int baseline = 32*(1<<20);
+ if(used > baseline) {
+ int dynamicTarget = (int)(0.95 * (used-baseline)) + baseline;
+ cc.gc(graph, dynamicTarget);
+ }
+ } else {
+ cc.gc(graph, clusterTarget);
+ }
_monitor.beginTask("Collect queries", IProgressMonitor.UNKNOWN);
qc.gc(graph, allowedTimeInMs);
}
ArrayList<CollectorCluster> toRelease = new ArrayList<CollectorCluster>();
for (CollectorCluster cluster : support.getResidentClusters()) {
- target -= support.getClusterSize(cluster);
- if (target > 0) {
- toRelease.add(cluster);
- } else {
+ toRelease.add(cluster);
+ long clusterSize = support.getClusterSize(cluster);
+ //System.err.println("release cluster with " + (clusterSize/1024) + " kiB - " + cluster);
+ target -= clusterSize;
+ if (target <= 0) {
break;
}
}