From 7e1295463467a1f66c5d5c0fb0750bcf0a1f402f Mon Sep 17 00:00:00 2001 From: auron_x Date: Sun, 31 Dec 2006 01:05:45 +0000 Subject: [PATCH] *) added possibility to set YaCy-Priority -> Linux-startscript has to be updated git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3148 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/PerformanceQueues_p.html | 21 +++++++++++++++++++++ htroot/PerformanceQueues_p.java | 14 +++++++++++++- startYACY.bat | 18 +++++++++++++----- startYACY_noconsole.bat | 27 ++++++++++++++++++++------- yacy.init | 9 ++++++++- 5 files changed, 75 insertions(+), 14 deletions(-) diff --git a/htroot/PerformanceQueues_p.html b/htroot/PerformanceQueues_p.html index f720c8a6a..6d432cfaa 100644 --- a/htroot/PerformanceQueues_p.html +++ b/htroot/PerformanceQueues_p.html @@ -205,6 +205,27 @@ +

+ YaCy Priority Settings: +

+
+
+
+
YaCy Process Priority:
+
+
+
Changes take effect after restart of YaCy
+
+
+
+

Proxy Performance Settings:

diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java index 1df1e0e27..bc1d50f66 100644 --- a/htroot/PerformanceQueues_p.java +++ b/htroot/PerformanceQueues_p.java @@ -256,6 +256,10 @@ public class PerformanceQueues_p { switchboard.setConfig("stacker.MinIdleThreads",minIdle); } + if ((post != null) && (post.containsKey("PrioritySubmit"))) { + switchboard.setConfig("javastart_priority",post.get("YaCyPriority","0")); + } + if ((post != null) && (post.containsKey("proxyControlSubmit"))) { int onlineCautionDelay = post.getInt("onlineCautionDelay", 30000); switchboard.setConfig("onlineCautionDelay", Integer.toString(onlineCautionDelay)); @@ -308,7 +312,15 @@ public class PerformanceQueues_p { prop.put("pool_2_minIdle",stackerPoolConfig.minIdle); prop.put("pool_2_numActive",switchboard.sbStackCrawlThread.getNumActiveWorker()); prop.put("pool_2_numIdle",switchboard.sbStackCrawlThread.getNumIdleWorker()); - prop.put("pool",3); + prop.put("pool",3); + + long curr_prio = switchboard.getConfigLong("javastart_priority",0); + prop.put("priority_realtime",(curr_prio==-20)?1:0); + prop.put("priority_high",(curr_prio==-15)?1:0); + prop.put("priority_above",(curr_prio==-10)?1:0); + prop.put("priority_normal",(curr_prio==0)?1:0); + prop.put("priority_below",(curr_prio==10)?1:0); + prop.put("priority_low",(curr_prio==20)?1:0); // return rewrite values for templates return prop; diff --git a/startYACY.bat b/startYACY.bat index 6569d6bb7..7f9dea5d7 100644 --- a/startYACY.bat +++ b/startYACY.bat @@ -12,12 +12,14 @@ REM Please change the "javastart" settings in the web-interface "Basic Configura set jmx= set jms= set javacmd=-Xmx64m -Xms10m -if exist DATA\SETTINGS\httpProxy.conf GoTo :GETJAVACMD +set priority=/NORMAL +if exist DATA\SETTINGS\httpProxy.conf GoTo :GETSTARTOPTS :STARTJAVA Rem Starting YaCy Echo Generated classpath:%CLASSPATH% Echo JRE Parameters:%javacmd% +Echo Priority:%priority% Echo ****************** YaCy Web Crawler/Indexer ^& Search Engine ******************* Echo **** (C) by Michael Peter Christen, usage granted under the GPL Version 2 **** @@ -28,20 +30,28 @@ Echo JRE Parameters:%javacmd% Echo ******************************************************************************* Echo ^>^> YaCy started as daemon process. Administration at http://localhost:%port% ^<^< -java %javacmd% -classpath %CLASSPATH% yacy +start "YaCy" %priority% java %javacmd% -classpath %CLASSPATH% yacy GoTo :END Rem This target is used to read java runtime parameters out of the yacy config file -:GETJAVACMD +:GETSTARTOPTS for /F "tokens=1,2 delims==" %%i in (DATA\SETTINGS\httpProxy.conf) do ( if "%%i"=="javastart_Xmx" set jmx=%%j if "%%i"=="javastart_Xms" set jms=%%j if "%%i"=="port" set port=%%j + if "%%i"=="javastart_priority" set priolvl=%%j ) if defined jmx set javacmd=-%jmx% if defined jms set javacmd=-%jms% %javacmd% if not defined port set port=8080 +if defined priolvl ( + if %priolvl% == 20 set priority=/LOW + if %priolvl% == 10 set priority=/BELOWNORMAL + if %priolvl% == -10 set priority=/ABOVENORMAL + if %priolvl% == -15 set priority=/HIGH + if %priolvl% == -20 set priority=/REALTIME +) GoTo :STARTJAVA @@ -51,5 +61,3 @@ Set CLASSPATH=%CLASSPATH%;%2 Rem Target needed to jump to the end of the file :END - - diff --git a/startYACY_noconsole.bat b/startYACY_noconsole.bat index 124fe62c1..89be2acab 100644 --- a/startYACY_noconsole.bat +++ b/startYACY_noconsole.bat @@ -1,4 +1,6 @@ @Echo Off +title YaCy + If %1.==CPGEN. GoTo :CPGEN Rem Generating the proper classpath unsing loops and labels @@ -6,28 +8,39 @@ Set CLASSPATH=classes;htroot For %%X in (lib/*.jar) Do Call %0 CPGEN lib\%%X For %%X in (libx/*.jar) Do Call %0 CPGEN libx\%%X +REM Please change the "javastart" settings in the web-interface "Basic Configuration" -> "Advanced" set jmx= set jms= set javacmd=-Xmx64m -Xms10m -if exist DATA\SETTINGS\httpProxy.conf GoTo :GETJAVACMD +set priority=/NORMAL +if exist DATA\SETTINGS\httpProxy.conf GoTo :GETSTARTOPTS :STARTJAVA -Rem Starting yacy -Echo Generated Classpath:%CLASSPATH% +Rem Starting YaCy +Echo Generated classpath:%CLASSPATH% Echo JRE Parameters:%javacmd% -javaw %javacmd% -classpath %CLASSPATH% yacy -Echo You can close the console safely +Echo Priority:%priority% +start %priority% javaw %javacmd% -classpath %CLASSPATH% yacy +Echo You can close the console safely now. GoTo :END Rem This target is used to read java runtime parameters out of the yacy config file -:GETJAVACMD +:GETSTARTOPTS for /F "tokens=1,2 delims==" %%i in (DATA\SETTINGS\httpProxy.conf) do ( if "%%i"=="javastart_Xmx" set jmx=%%j if "%%i"=="javastart_Xms" set jms=%%j + if "%%i"=="javastart_priority" set priolvl=%%j ) if defined jmx set javacmd=-%jmx% if defined jms set javacmd=-%jms% %javacmd% +if defined priolvl ( + if %priolvl% == 20 set priority=/LOW + if %priolvl% == 10 set priority=/BELOWNORMAL + if %priolvl% == -10 set priority=/ABOVENORMAL + if %priolvl% == -15 set priority=/HIGH + if %priolvl% == -20 set priority=/REALTIME +) GoTo :STARTJAVA @@ -36,4 +49,4 @@ Rem This target is used to concatenate the classpath parts Set CLASSPATH=%CLASSPATH%;%2 Rem Target needed to jump to the end of the file -:END \ No newline at end of file +:END diff --git a/yacy.init b/yacy.init index 5d114964b..2ce89d857 100644 --- a/yacy.init +++ b/yacy.init @@ -568,7 +568,7 @@ ramCacheProfiles = 8192 ramCacheProfiles_time= 500 # default memory settings for startup of yacy -# is only valid in unix/shell environments and +# is valid in unix/shell and windows environments but # not for first startup of YaCy # -Xmx set maximum Java heap size @@ -577,6 +577,13 @@ javastart_Xmx=Xmx96m # -Xms set initial Java heap size javastart_Xms=Xms96m +# priority of the yacy-process +# is valid in unix/shell and windows environments but +# not for first startup of YaCy +# UNIX: corresponds to the nice-level +# WIN: -20=realtime;-15=high;-10=above;0=normal;10=below;20=low +javastart_priority=0 + # performance properties for the word index cache # wordCacheMaxLow/High is the number of word indexes that shall be held in the # ram cache during indexing. When YaCy is shut down, this cache must be