perfsonar-dev - perfsonar: r5301 - in branches/new-structure-with-base2/ps-mdm-ls/src/main: java/org/perfsonar/service/lookupservice/dao java/org/perfsonar/service/lookupservice/registration java/org/perfsonar/service/lookupservice/summarization resources resources/perfsonar/conf
Subject: perfsonar development work
List archive
perfsonar: r5301 - in branches/new-structure-with-base2/ps-mdm-ls/src/main: java/org/perfsonar/service/lookupservice/dao java/org/perfsonar/service/lookupservice/registration java/org/perfsonar/service/lookupservice/summarization resources resources/perfsonar/conf
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5301 - in branches/new-structure-with-base2/ps-mdm-ls/src/main: java/org/perfsonar/service/lookupservice/dao java/org/perfsonar/service/lookupservice/registration java/org/perfsonar/service/lookupservice/summarization resources resources/perfsonar/conf
- Date: Thu, 8 Oct 2009 10:11:39 -0400
Author: trzaszcz
Date: 2009-10-08 10:11:39 -0400 (Thu, 08 Oct 2009)
New Revision: 5301
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/dao/SummarizationDAO.java
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/LSSummaryRegisterDataSource.java
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/ModificationCounterComponent.java
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/SummarizationBuilder.java
branches/new-structure-with-base2/ps-mdm-ls/src/main/resources/log4j.properties
branches/new-structure-with-base2/ps-mdm-ls/src/main/resources/perfsonar/conf/configuration.xml
Log:
refactoring,logging enchancement,performance optymalization
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/dao/SummarizationDAO.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/dao/SummarizationDAO.java
2009-10-06 14:01:34 UTC (rev 5300)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/dao/SummarizationDAO.java
2009-10-08 14:11:39 UTC (rev 5301)
@@ -22,22 +22,14 @@
StringBuffer sb = new StringBuffer();
- sb.append(XQUERY_DECLARE_NAMESPACES);
- sb
- .append("update delete
/nmwg:store[@type='LSStore-summary']/nmwg:data");
+// sb.append(XQUERY_DECLARE_NAMESPACES);
+ sb.append("xmldb:copy('/db/copy/', '/db/ls/',
'LSStore-summary.xml')");
+
+// .append("update delete
/nmwg:store[@type='LSStore-summary']/*");
getDataStorage().performXQuery(sb.toString(),
getDataCollection(),
getDataCredential());
- sb = new StringBuffer();
-
- sb.append(XQUERY_DECLARE_NAMESPACES);
- sb
- .append("update delete
/nmwg:store[@type='LSStore-summary']/nmwg:metadata");
-
- getDataStorage().performXQuery(sb.toString(),
getDataCollection(),
- getDataCredential());
-
}
public void putSummaryData(Element m) throws PerfSONARException {
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/LSSummaryRegisterDataSource.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/LSSummaryRegisterDataSource.java
2009-10-06 14:01:34 UTC (rev 5300)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/LSSummaryRegisterDataSource.java
2009-10-08 14:11:39 UTC (rev 5301)
@@ -24,7 +24,6 @@
protected ISummarizationDAO dao;
public LSSummaryRegisterDataSource() throws PerfSONARException {
-
super();
dao = LookupServiceDAOFactory.getSumarizationDAO();
}
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
2009-10-06 14:01:34 UTC (rev 5300)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
2009-10-08 14:11:39 UTC (rev 5301)
@@ -29,6 +29,7 @@
private int NR_OF_MODIFICATIONS;
private int NR_OF_ITERATIONS;
private int iteration = 0;
+ private boolean firstIteration=true;
private ISummarizationDAO summarizationDao;
private SummarizationBuilder builder;
private Logger logger = Logger
@@ -61,18 +62,21 @@
NR_OF_MODIFICATIONS =
getOption("nrOfModifications").getValueAsInteger();
NR_OF_ITERATIONS =
getOption("nrOfIterations").getValueAsInteger();
-
+
logger.debug("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
try {
- if (iteration==0) {
+ if (firstIteration) {
// in first iteration summary data is build
+ logger.debug(" ----------------FIRST
TIME------------------------");
synchronizeSummarizationCollection();
iteration++;
+ firstIteration=false;
} else if (iteration != NR_OF_ITERATIONS) {
if (nrOfChanges >= NR_OF_MODIFICATIONS) {
// if nr of changes is greater then
const NR_OF_MODIFICATIONS -> summary data must be refreshed
+ logger.debug("------------ 1
-----------------");
synchronizeSummarizationCollection();
component.resetCounter();
}
@@ -82,6 +86,7 @@
iteration = 0;
//summarization is obligatory when there are
any differences
if (nrOfChanges != 0) {
+ logger.debug("----------------------
2 ----------------");
synchronizeSummarizationCollection();
component.resetCounter();
}
@@ -92,16 +97,22 @@
} catch (PerfSONARException e1) {
e1.printStackTrace();
}
-
+
logger.debug("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
private void synchronizeSummarizationCollection() throws
PerfSONARException {
logger.debug("building summarization data");
+ long t1=System.currentTimeMillis();
summarizationDao.removeSummaryData();
+
System.out.println("1.+++++++++++++"+(System.currentTimeMillis()-t1));
+ t1=System.currentTimeMillis();
List<Element> datas = builder.build();
+
System.out.println("2.+++++++++++++"+(System.currentTimeMillis()-t1));
+ t1=System.currentTimeMillis();
for (Element element : datas) {
summarizationDao.putSummaryData(element);
}
+
System.out.println("3.+++++++++++++"+(System.currentTimeMillis()-t1));
}
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/ModificationCounterComponent.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/ModificationCounterComponent.java
2009-10-06 14:01:34 UTC (rev 5300)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/ModificationCounterComponent.java
2009-10-08 14:11:39 UTC (rev 5301)
@@ -34,7 +34,7 @@
*/
public void increaseCounter(){
counter++;
- logger.debug("Counter incresed "+counter);
+ logger.debug("Counter increased "+counter);
}
public void resetCounter(){
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/SummarizationBuilder.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/SummarizationBuilder.java
2009-10-06 14:01:34 UTC (rev 5300)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/SummarizationBuilder.java
2009-10-08 14:11:39 UTC (rev 5301)
@@ -15,13 +15,12 @@
import org.perfsonar.base2.xml.nmwg.Message;
import org.perfsonar.service.lookupservice.dao.ISummarizationDAO;
import
org.perfsonar.service.lookupservice.registration.DiscoveryRequestGenerator;
-import
org.perfsonar.service.lookupservice.registration.LSSummaryRegisterDataSource;
import
org.perfsonar.service.lookupservice.registration.summarization.SummarizeIpAddrs;
public class SummarizationBuilder {
protected static final Logger logger = Logger
-
.getLogger(LSSummaryRegisterDataSource.class.getName());
+ .getLogger(SummarizationBuilder.class);
private static final int IP = 100;
private static final int DOMAIN = 200;
@@ -63,14 +62,14 @@
i++; // increase counter
// summarize IPs
- logger.debug("Summarize IP addresses for service #["
+ i + "]");
+// logger.debug("Summarize IP addresses for service #["
+ i + "]");
s.setIpAddresses(summarizeIPAddresses(s.getIpAddresses()));
// summarize domains
- logger.debug("Summarize domains for service #[" + i +
"]");
+// logger.debug("Summarize domains for service #[" + i +
"]");
s.setDomains(summarizeDomains(s.getDomains()));
- logger.debug("Summarize eventTypes and keywords...");
+// logger.debug("Summarize eventTypes and keywords...");
// summarize eventTypes
// no summarization, just store
@@ -80,7 +79,7 @@
}
// TODO: TEMPORARY:
- showSummary(summaries);
+// showSummary(summaries);
DiscoveryRequestGenerator gen = new
DiscoveryRequestGenerator();
Message msg = gen.createMessageElement();
@@ -296,6 +295,7 @@
}
+ @SuppressWarnings("unused")
private void showSummary(Map<String, ServiceSummary> summaries) {
Iterator<Entry<String, ServiceSummary>> i =
summaries.entrySet()
.iterator();
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/resources/log4j.properties
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/resources/log4j.properties
2009-10-06 14:01:34 UTC (rev 5300)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/resources/log4j.properties
2009-10-08 14:11:39 UTC (rev 5301)
@@ -9,7 +9,6 @@
log4j.appender.out=org.apache.log4j.RollingFileAppender
log4j.appender.out.MaxFileSize=100KB
-log4j.appender.out.treshold=warn
log4j.appender.out.MaxBackupIndex=1
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=[%p] %c{1} - %m%n
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/resources/perfsonar/conf/configuration.xml
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/resources/perfsonar/conf/configuration.xml
2009-10-06 14:01:34 UTC (rev 5300)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/resources/perfsonar/conf/configuration.xml
2009-10-08 14:11:39 UTC (rev 5301)
@@ -12,8 +12,8 @@
<!-- Lookup Info of the LS instance -->
<lookupInformation>
- <option name="accessPoint"
value="http://localhost:8080/axis2/services/xmlls"/>
- <option name="serviceName" value="Geant2 Java XML LS 2.0"/>
+ <option name="accessPoint"
value="http://localhost:8080/perfsonar-java-xml-ls/services/LookupService"/>
+ <option name="serviceName" value="Geant3 JAVA - XML LS "/>
<option name="serviceType" value="LS"/>
</lookupInformation>
@@ -113,6 +113,7 @@
<option name="exist-config" value="exist"/> <!-- reference to eXist
DB XML config-->
</component>
+ <!-- contains a nr of changes in DB - is used to synchronization -->
<component name="modificationCounterComponent"
className="org.perfsonar.service.lookupservice.summarization.ModificationCounterComponent">
</component>
@@ -127,10 +128,15 @@
<action name="LSCleanup_1"
className="org.perfsonar.service.lookupservice.LSCleanupSchedulerAction">
<option name="status" value="on" />
- <option name="interval" value="45" />
- <option name="lsTTL" value="360"/>
+ <option name="interval" value="300" />
+ <option name="lsTTL" value="86400"/>
</action>
+ <!--
+ this action supports synchronization of summarized data
stored in LSStore-summary with data stored in LSStore.xml
+ nrOfModifications - nr of changes in db after which
summarization process is executed immediately
+ nrOfIterations - after this nr of iteration if there are
some changes in db - summarization process is executed
+ -->
<action name="LSSummarySynchronization"
className="org.perfsonar.service.lookupservice.summarization.LSSummarySynchronizationAction">
<option name="status" value="on" />
<option name="interval" value="45" />
@@ -142,7 +148,7 @@
<action name="registration"
className="org.perfsonar.base2.service.registration.LSRegistrationAction">
<option name="status" value="on" />
- <option name="interval" value="3600" />
+ <option name="interval" value="43200" />
<option name="registerDataSource"
value="org.perfsonar.service.lookupservice.registration.LSSummaryRegisterDataSource"/>
- perfsonar: r5301 - in branches/new-structure-with-base2/ps-mdm-ls/src/main: java/org/perfsonar/service/lookupservice/dao java/org/perfsonar/service/lookupservice/registration java/org/perfsonar/service/lookupservice/summarization resources resources/perfsonar/conf, svnlog, 10/08/2009
Archive powered by MHonArc 2.6.16.