Bonjour,
J'ignore si mon sujet doit être posté ici ou plutôt sur le forum Java, que les modérateurs m'excusent...
J'ai un gros problème de performances avec XALAN : lorsque je transforme un XML selon un XSL, et que le fichier résultat se trouve sur mon disque dur, la transformation ne met que 3 secondes environ...Lorsque le fichier résultat se trouve sur un drive réseau, cette même transformation s'effectue en... 116 secondes!!!
Je précise que le drive réseau est lié via NBT, sous Windows, que mon réseau est en 100 Mb/s HALF Duplex, et que je n'ai pas de problèmes en faisant une simple copie de fichiers de mon disque dur vers ce drive réseau.
Voici les différences au profiling :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79 Fichier résultat sur disque dur local C:\TEMP>java -Xprof org.apache.xalan.xslt.Process -in mgclis.xml -xsl xml2csv.xsl -out toto.csv > local.txt Flat profile of 3.45 secs (215 total ticks): main Interpreted + native Method 0.5% 1 + 0 org.apache.crimson.parser.XmlReader$BaseReader.close 0.5% 1 + 0 org.apache.xpath.axes.LocPathIterator.setRoot 0.5% 1 + 0 org.apache.xml.utils.QName.toString 0.5% 1 + 0 org.apache.xalan.templates.ElemIf.execute 0.5% 1 + 0 org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.endElement 0.5% 1 + 0 java.util.Vector.removeElementAt 0.5% 1 + 0 org.apache.xpath.axes.NodeSequence.runTo 0.5% 1 + 0 org.apache.xml.utils.ObjectStack.setTop 0.5% 0 + 1 java.io.InputStreamReader.<init> 0.5% 0 + 1 java.util.zip.ZipFile.getEntry 0.5% 0 + 1 java.lang.ClassLoader.findBootstrapClass 0.5% 1 + 0 java.util.Properties.load 0.5% 0 + 1 org.apache.xml.utils.XMLChar.<clinit> 6.1% 9 + 4 Total interpreted Compiled + native Method 2.8% 6 + 0 org.apache.xpath.functions.FuncTranslate.execute 2.8% 6 + 0 org.apache.xml.dtm.ref.DTMDefaultBase.makeNodeIdentity 2.3% 5 + 0 org.apache.xml.dtm.ref.DTMManagerDefault.getDTM 2.3% 5 + 0 java.util.Vector.size 2.3% 2 + 3 java.lang.StringBuffer.append 1.9% 4 + 0 org.apache.xpath.objects.XStringForFSB.str 1.9% 4 + 0 org.apache.xalan.templates.ElemForEach.transformSelectedNodes 1.9% 4 + 0 sun.nio.cs.ISO_8859_1$Encoder.encodeArrayLoop 1.9% 4 + 0 java.util.Vector.elementAt 1.9% 4 + 0 org.apache.xml.dtm.ref.DTMDefaultBase._parent 1.4% 3 + 0 org.apache.xalan.serialize.SerializerToText.writeNormalizedChars 1.4% 3 + 0 org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.getStringValue 1.4% 3 + 0 vtable chunks 1.4% 3 + 0 org.apache.crimson.parser.SimpleHashtable.get 1.4% 3 + 0 sun.nio.cs.StreamEncoder.flush 0.9% 2 + 0 org.apache.xalan.templates.ElemChoose.execute 0.9% 2 + 0 java.util.Stack.peek 0.9% 2 + 0 org.apache.xpath.objects.XObject.execute 0.9% 2 + 0 org.apache.xalan.transformer.TransformerImpl.executeChildTemplates 0.9% 2 + 0 java.util.Vector.isEmpty 0.9% 2 + 0 org.apache.xpath.functions.FuncPosition.getPositionInContextNodeList 0.9% 2 + 0 org.apache.xpath.axes.PredicatedNodeTest.clone 0.9% 2 + 0 org.apache.xml.utils.ObjectStack.push 0.9% 2 + 0 sun.nio.cs.StreamEncoder.write 0.9% 2 + 0 org.apache.xpath.functions.FuncPosition.execute 54.7% 111 + 6 Total compiled (including elided) Stub + native Method 26.6% 0 + 57 java.io.FileOutputStream.writeBytes 5.1% 0 + 11 java.lang.Object.clone 31.8% 0 + 68 Total stub Runtime stub + native Method 0.5% 1 + 0 interpreter_entries Runtime1 stub 0.5% 1 + 0 Total runtime stubs Thread-local ticks: 0.5% 1 Blocked (of total) 0.9% 2 Class loader 0.9% 2 Interpreter 5.1% 11 Compilation Flat profile of 0.01 secs (1 total ticks): DestroyJavaVM Thread-local ticks: 100.0% 1 Blocked (of total) Global summary of 3.48 seconds: 100.0% 223 Received ticks 2.7% 6 Received GC ticks 4.9% 11 Compilation 0.9% 2 Class loader 0.9% 2 InterpreterVoilà... On se rend compte que dans le cas du drive réseau, c'est l'écriture des octets dans le fichier de résultat qui prend énormément de temps (ça me fait penser à des "I/O Wait")... Dans le cas de l'écriture sur mon disque dur local, le CPU est pris à 100%, alors que dans le cas de l'écriture vers le drive réseau, le CPU pris par Xalan oscille entre 5 et 10 % seulement... Comme s'il était perpétuellement en attente d'I/O...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90 Fichier résultat sur drive réseau C:\TEMP>java -Xprof org.apache.xalan.xslt.Process -in mgclis.xml -xsl xml2csv.xsl -out K:\toto.csv > reseau.txt Flat profile of 116.78 secs (7466 total ticks): main Interpreted + native Method 0.6% 1 + 47 java.io.FileOutputStream.writeBytes 0.0% 1 + 0 java.io.OutputStreamWriter.flush 0.0% 1 + 0 org.apache.xpath.axes.PredicatedNodeTest.resetProximityPositions 0.0% 1 + 0 org.apache.xpath.functions.FuncContains.execute 0.0% 1 + 0 org.apache.xpath.axes.NodeSequence.setRoot 0.0% 1 + 0 org.apache.xpath.functions.FuncPosition.execute 0.0% 1 + 0 org.apache.xml.dtm.ref.DTMDefaultBase.getFirstChild 0.0% 1 + 0 org.apache.xalan.templates.ElemTextLiteral.execute 0.0% 0 + 1 java.util.zip.ZipFile.open 0.0% 1 + 0 org.apache.xpath.axes.NodeSequence.runTo 0.0% 1 + 0 org.apache.xpath.axes.ChildTestIterator.setRoot 0.0% 0 + 1 sun.text.resources.LocaleElements_fr.getContents 0.0% 1 + 0 org.apache.xpath.functions.FuncTranslate.execute 0.0% 1 + 0 org.apache.xml.utils.FastStringBuffer.getString 0.0% 0 + 1 java.lang.Class.forName0 0.0% 0 + 1 java.io.WinNTFileSystem.getBooleanAttributes 0.0% 1 + 0 org.apache.crimson.parser.InputEntity.fillbuf 0.0% 0 + 1 org.apache.xpath.objects.XObject.notEquals 0.0% 0 + 1 org.apache.crimson.parser.XMLReaderImpl.setFeature 0.0% 1 + 0 org.apache.xpath.axes.LocPathIterator.asIterator 0.0% 1 + 0 org.apache.xpath.functions.FuncLast.execute 0.0% 1 + 0 org.apache.xalan.templates.ElemForEach.transformSelectedNodes 0.0% 1 + 0 org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.startElement 0.0% 0 + 1 org.apache.xml.utils.XMLChar.<clinit> 1.0% 17 + 54 Total interpreted Compiled + native Method 0.2% 12 + 0 org.apache.xpath.functions.FuncPosition.execute 0.2% 12 + 0 vtable chunks 0.1% 10 + 0 org.apache.xalan.serialize.SerializerToXML.flushWriter 0.1% 3 + 5 java.lang.StringBuffer.append 0.1% 7 + 0 org.apache.xml.utils.ObjectStack.setTop 0.1% 7 + 0 java.util.Vector.size 0.1% 6 + 0 sun.nio.cs.StreamEncoder.write 0.1% 6 + 0 org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.getStringValue 0.1% 6 + 0 org.apache.xpath.functions.FuncTranslate.execute 0.1% 6 + 0 org.apache.xalan.templates.ElemValueOf.execute 0.1% 5 + 0 org.apache.xalan.templates.ElemForEach.transformSelectedNodes 0.1% 5 + 0 java.util.Vector.elementAt 0.1% 5 + 0 org.apache.xalan.serialize.SerializerToText.writeNormalizedChars 0.1% 5 + 0 org.apache.xpath.objects.XStringForFSB.str 0.1% 5 + 0 org.apache.xml.dtm.ref.DTMDefaultBase._exptype 0.1% 5 + 0 org.apache.xalan.transformer.TransformerImpl.executeChildTemplates 0.1% 5 + 0 org.apache.xpath.axes.IteratorPool.getInstance 0.1% 5 + 0 org.apache.xalan.templates.ElemChoose.execute 0.1% 4 + 0 sun.nio.cs.ISO_8859_1$Encoder.encodeArrayLoop 0.1% 4 + 0 org.apache.xalan.serialize.SerializerToText.characters 0.1% 4 + 0 org.apache.xml.utils.IntStack.push 0.1% 4 + 0 java.lang.String.equals 0.1% 4 + 0 org.apache.xpath.axes.BasicTestIterator.nextNode 0.1% 4 + 0 java.lang.String.<init> 0.0% 3 + 0 sun.nio.cs.StreamEncoder$CharsetSE.writeBytes 3.3% 241 + 9 Total compiled (including elided) Stub + native Method 95.0% 2 + 7088 java.io.FileOutputStream.writeBytes 0.4% 1 + 31 java.lang.Object.clone 95.4% 3 + 7119 Total stub Runtime stub + native Method 0.0% 3 + 0 interpreter_entries Runtime1 stub 0.0% 3 + 0 Total runtime stubs Thread-local ticks: 0.1% 4 Class loader 0.1% 6 Interpreter 0.1% 10 Compilation Flat profile of 0.01 secs (1 total ticks): DestroyJavaVM Thread-local ticks: 100.0% 1 Blocked (of total) Global summary of 116.81 seconds: 100.0% 7477 Received ticks 0.1% 9 Received GC ticks 0.1% 10 Compilation 0.1% 4 Class loader 0.1% 6 Interpreter
Si quelqu'un a une idée...
Merci d'avance.
Nico'
P.S. : J'utilise Java HotSpot 1.4.2_03, Xalan 2.7.0.
Partager