when scaling the number of remote peers, also consider the machine load

and the number of cores
pull/1/head
Michael Peter Christen 11 years ago
parent f8ce7040ab
commit ba44eb1160

@ -66,6 +66,14 @@ public class Memory {
public static final long used() {
return total() - free();
}
/**
* get number of CPU cores
* @return number of CPU cores
*/
public static final long cores() {
return runtime.availableProcessors();
}
/**
* get the system load within the last minute

@ -34,6 +34,7 @@ import org.apache.solr.client.solrj.SolrQuery;
import net.yacy.cora.document.encoding.ASCII;
import net.yacy.cora.storage.HandleSet;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.cora.util.Memory;
import net.yacy.kelondro.util.MemoryControl;
import net.yacy.repository.Blacklist;
import net.yacy.search.Switchboard;
@ -145,6 +146,9 @@ public class RemoteSearch extends Thread {
int redundancy = event.peers.redundancy();
if (indexingQueueSize > 10) redundancy = Math.max(1, redundancy - 1);
if (indexingQueueSize > 50) redundancy = Math.max(1, redundancy - 1);
if (Memory.load() > 2.0) redundancy = Math.max(1, redundancy - 1);
if (Memory.cores() < 4) redundancy = Math.max(1, redundancy - 1);
if (Memory.cores() == 1) redundancy = 1;
int minage = 3;
int robinsoncount = event.peers.scheme.verticalPartitions() * redundancy / 2;
if (indexingQueueSize > 10) robinsoncount = Math.max(1, robinsoncount / 2);

Loading…
Cancel
Save