<!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:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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 &quot;multithreaded&quot; 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>&nbsp;&nbsp;&nbsp; private ThreadLocal localFormatter = new ThreadLocal() {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected Object initialValue()</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Properties options = new Properties();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; options.setProperty(&quot;CONFIG&quot;, xepRoot + &quot;/xep.xml&quot;);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; options.setProperty(&quot;VALIDATE&quot;, &quot;false&quot;);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new FormatterImpl(options, new XepLoggerAdapter(log));</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (ConfigurationException e) {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.error(e.getMessage(), e);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new RuntimeException(e);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; };</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; public void render(...)</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Formatter formatter = (Formatter) localFormatter.get();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String documentURI = baseDir + &quot;/document&quot;;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOTarget target = new FOTarget(out, &quot;PDF&quot;);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Result result = new SAXResult(</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; formatter.createContentHandler(documentURI, target));</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; transformer.transform(saxSource, result);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finally</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.flush();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.close();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; }</FONT>
</P>

</BODY>
</HTML>