From 353a924760023dc938cbb11b881552d77e9dc097 Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 14 Jun 2010 21:36:40 +0000 Subject: [PATCH] - changed default memory to 500m - now xms is lower than xmx (lets try what happens) - removed default path for intranet crawl starts to avoid confusion as seen on linuxtag - added time-out to upnp request (i have a new router which may need that) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6916 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- defaults/yacy.init | 2 +- htroot/CrawlStart_p.java | 13 ++++++------- htroot/PerformanceQueues_p.java | 17 ++++++++--------- .../net/sbbi/upnp/DiscoveryAdvertisement.java | 18 ++++++++++++++---- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/defaults/yacy.init b/defaults/yacy.init index 38a2778d6..86ac2d0a9 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -603,7 +603,7 @@ cleanup.deletionPublishedNews = true # -Xmx and -Xms maximum/init Java heap size # both values should be equal, # othervise the YaCy-internal memory supervision does not work -javastart_Xmx=Xmx180m +javastart_Xmx=Xmx600m javastart_Xms=Xms180m # YaCy is able to use RAM copies of database tables. This needs a lot of RAM diff --git a/htroot/CrawlStart_p.java b/htroot/CrawlStart_p.java index bd2402a7d..9d1d472e9 100644 --- a/htroot/CrawlStart_p.java +++ b/htroot/CrawlStart_p.java @@ -26,7 +26,6 @@ import de.anomic.crawler.CrawlProfile; import de.anomic.http.server.RequestHeader; -import de.anomic.search.Switchboard; import de.anomic.search.SwitchboardConstants; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -35,17 +34,17 @@ public class CrawlStart_p { public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) { // return variable that accumulates replacements - final Switchboard sb = (Switchboard) env; + //final Switchboard sb = (Switchboard) env; final serverObjects prop = new serverObjects(); // define visible variables - String a = sb.peers.mySeed().getPublicAddress(); - boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet"); - String repository = "http://" + ((a == null) ? "localhost:" + sb.getConfig("port", "8080") : a) + "/repository/"; - prop.put("starturl", (intranet) ? repository : "http://"); + //String a = sb.peers.mySeed().getPublicAddress(); + //boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet"); + //String repository = "http://" + ((a == null) ? "localhost:" + sb.getConfig("port", "8080") : a) + "/repository/"; + prop.put("starturl", /*(intranet) ? repository :*/ "http://"); prop.put("proxyPrefetchDepth", env.getConfig("proxyPrefetchDepth", "0")); prop.put("crawlingDepth", env.getConfig("crawlingDepth", "0")); - prop.put("mustmatch", (intranet) ? repository + ".*" : CrawlProfile.MATCH_ALL); + prop.put("mustmatch", /*(intranet) ? repository + ".*" :*/ CrawlProfile.MATCH_ALL); prop.put("mustnotmatch", CrawlProfile.MATCH_NEVER); prop.put("crawlingIfOlderCheck", "0"); diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java index 3dd7c16ac..8ae423edc 100644 --- a/htroot/PerformanceQueues_p.java +++ b/htroot/PerformanceQueues_p.java @@ -84,13 +84,12 @@ public class PerformanceQueues_p { } } if (post.containsKey("Xmx")) { - int xmx = 180; // default maximum heap size - try { xmx = Integer.parseInt(post.get("Xmx", Integer.toString(xmx))); } catch (final NumberFormatException e){} - if (!(OS.isWin32 && xmx >= 2000)){ - sb.setConfig("javastart_Xmx", "Xmx" + xmx + "m"); - sb.setConfig("javastart_Xms", "Xms" + xmx + "m"); - prop.put("setStartupCommit", "1"); - } + int xmx = post.getInt("Xmx", 500); // default maximum heap size + if (OS.isWin32) xmx = Math.min(2000, xmx); + int xms = xmx / 4; + sb.setConfig("javastart_Xmx", "Xmx" + xmx + "m"); + sb.setConfig("javastart_Xms", "Xms" + xms + "m"); + prop.put("setStartupCommit", "1"); } if(post.containsKey("diskFree")) { int diskFree = 3000; // default @@ -354,9 +353,9 @@ public class PerformanceQueues_p { prop.put("priority_low",(curr_prio==20) ? "1" : "0"); // parse initialization memory settings - final String Xmx = sb.getConfig("javastart_Xmx", "Xmx120m").substring(3); + final String Xmx = sb.getConfig("javastart_Xmx", "Xmx500m").substring(3); prop.put("Xmx", Xmx.substring(0, Xmx.length() - 1)); - final String Xms = sb.getConfig("javastart_Xms", "Xms120m").substring(3); + final String Xms = sb.getConfig("javastart_Xms", "Xms500m").substring(3); prop.put("Xms", Xms.substring(0, Xms.length() - 1)); final String diskFree = sb.getConfig(SwitchboardConstants.DISK_FREE, "3000"); diff --git a/source/net/sbbi/upnp/DiscoveryAdvertisement.java b/source/net/sbbi/upnp/DiscoveryAdvertisement.java index 10dffdb1b..227e9d314 100644 --- a/source/net/sbbi/upnp/DiscoveryAdvertisement.java +++ b/source/net/sbbi/upnp/DiscoveryAdvertisement.java @@ -45,6 +45,9 @@ * on behalf of SuperBonBon Industries. For more information on * SuperBonBon Industries, please see . */ + +// [MC] (C) (also) by Michael Christen: added timeout for discovery + package net.sbbi.upnp; import java.io.IOException; @@ -104,8 +107,14 @@ public final class DiscoveryAdvertisement implements Runnable { private java.net.MulticastSocket skt; private DatagramPacket input; - + private int timeout; + private DiscoveryAdvertisement() { + this.timeout = 3000; + } + + private DiscoveryAdvertisement(int timeout) { + this.timeout = timeout; } public final static DiscoveryAdvertisement getInstance() { @@ -231,7 +240,7 @@ public final class DiscoveryAdvertisement implements Runnable { inService = true; while ( inService ) { try { - listenBroadCast(); + listenBroadCast(this.timeout); } catch ( SocketTimeoutException ex ) { // ignoring } catch ( IOException ioEx ) { @@ -253,8 +262,9 @@ public final class DiscoveryAdvertisement implements Runnable { } } - private void listenBroadCast() throws IOException { - + private void listenBroadCast(int timeout) throws IOException { + + skt.setSoTimeout(timeout); // added by [MC] skt.receive( input ); InetAddress from = input.getAddress(); String received = new String( input.getData(), input.getOffset(), input.getLength() );