<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2657.73">
<TITLE>multi threaded access issue ?</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Hello all: </FONT>
</P>
<P><FONT SIZE=2>I am doing some performance tests with XEP 4.4. I am testing in in two environments. The first is a hyper-threaded machine, the second on a dual processor Xeon. Our code (see snippet below) is using the java API to access XEP. We are producing PDF. My issue is the following: we have notice a considerable slow down when using multi-threaded access in conjunction with a Hyper Threaded, or Multiple CPU box. The slow down seems to disappear when we disable Hyper-Threading. Once disabled we are able to use "multithreaded" access and get faster throughput on the HT machine. However, on the 2CPU box we have to set out thread count to 1 in order to not experience a slowdown in production of the PDF. Any ideas as to why this is happening ?</FONT></P>
<P><FONT SIZE=2>Thanks in advance</FONT>
</P>
<P><FONT SIZE=2>Rob</FONT>
</P>
<BR>
<P><FONT SIZE=2>+++++++ Test One +++++++++</FONT>
</P>
<P><FONT SIZE=2>Running 1000 documents through on the P4 3.2HT machine. The input is a .fo document.</FONT>
</P>
<P><FONT SIZE=2>Hyperthreaded, 2 threads - 4.2 minutes</FONT>
<BR><FONT SIZE=2>Hyperthreaded, 1 thread - 2.9 minutes</FONT>
</P>
<P><FONT SIZE=2>Non-hyperthreaded, 1 thread - 2.3 minutes</FONT>
<BR><FONT SIZE=2>Non-hyperthreaded, 2 threads - 2.3minutes</FONT>
</P>
<P><FONT SIZE=2>Environment</FONT>
<BR><FONT SIZE=2>WinXP</FONT>
<BR><FONT SIZE=2>P4HT 3.2 GHz HT</FONT>
<BR><FONT SIZE=2>1Gig RAM</FONT>
<BR><FONT SIZE=2>XEP 4.4</FONT>
<BR><FONT SIZE=2>Java 4.1.2_8</FONT>
</P>
<P><FONT SIZE=2>Notice the drastic increase in time with multithreaded access on a hyper-threaded machine......</FONT>
</P>
<BR>
<P><FONT SIZE=2>+++++++ Test Two +++++++++</FONT>
</P>
<P><FONT SIZE=2>Running 1000 documents through on the 2CPU XEON 3.4 machine. The input is a .fo document.</FONT>
</P>
<P><FONT SIZE=2>2CPU, 4 threads - 9.1 minutes</FONT>
<BR><FONT SIZE=2>2CPU, 1 thread - 2.4 minutes</FONT>
</P>
<P><FONT SIZE=2>Environment</FONT>
<BR><FONT SIZE=2>WinXP</FONT>
<BR><FONT SIZE=2>2CPU Xeon 3.2Ghz</FONT>
<BR><FONT SIZE=2>2Gig RAM</FONT>
<BR><FONT SIZE=2>XEP 4.4</FONT>
<BR><FONT SIZE=2>Java 4.1.2_8</FONT>
</P>
<BR>
<P><FONT SIZE=2>CODE Snippet:</FONT>
</P>
<P><FONT SIZE=2> private ThreadLocal localFormatter = new ThreadLocal() {</FONT>
<BR><FONT SIZE=2> protected Object initialValue()</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> Properties options = new Properties();</FONT>
<BR><FONT SIZE=2> options.setProperty("CONFIG", xepRoot + "/xep.xml");</FONT>
<BR><FONT SIZE=2> options.setProperty("VALIDATE", "false");</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> try {</FONT>
<BR><FONT SIZE=2> return new FormatterImpl(options, new XepLoggerAdapter(log));</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> catch (ConfigurationException e) {</FONT>
<BR><FONT SIZE=2> log.error(e.getMessage(), e);</FONT>
<BR><FONT SIZE=2> throw new RuntimeException(e);</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> };</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> public void render(...)</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> Formatter formatter = (Formatter) localFormatter.get();</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> String documentURI = baseDir + "/document";</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> FOTarget target = new FOTarget(out, "PDF");</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> try</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> Result result = new SAXResult(</FONT>
<BR><FONT SIZE=2> formatter.createContentHandler(documentURI, target));</FONT>
<BR><FONT SIZE=2> transformer.transform(saxSource, result);</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> finally</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> out.flush();</FONT>
<BR><FONT SIZE=2> out.close();</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> }</FONT>
</P>
</BODY>
</HTML>