IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XML/XSL et SOAP Discussion :

Xalan : pb de performances si écriture sur drive réseau


Sujet :

XML/XSL et SOAP

  1. #1
    Membre régulier
    Inscrit en
    janvier 2006
    Messages
    120
    Détails du profil
    Informations forums :
    Inscription : janvier 2006
    Messages : 120
    Points : 88
    Points
    88
    Par défaut Xalan : pb de performances si écriture sur drive réseau
    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 &#40;including elided&#41;
     
             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&#58;
      0.5%     1             Blocked &#40;of total&#41;
      0.9%     2             Class loader
      0.9%     2             Interpreter
      5.1%    11             Compilation
     
     
    Flat profile of 0.01 secs &#40;1 total ticks&#41;&#58; DestroyJavaVM
     
      Thread-local ticks&#58;
    100.0%     1             Blocked &#40;of total&#41;
     
     
    Global summary of 3.48 seconds&#58;
    100.0%   223             Received ticks
      2.7%     6             Received GC ticks
      4.9%    11             Compilation
      0.9%     2             Class loader
      0.9%     2             Interpreter
    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&#58;\TEMP>java -Xprof org.apache.xalan.xslt.Process -in mgclis.xml -xsl xml2csv.xsl -out K&#58;\toto.csv > reseau.txt
     
     
    Flat profile of 116.78 secs &#40;7466 total ticks&#41;&#58; 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 &#40;including elided&#41;
     
             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&#58;
      0.1%     4             Class loader
      0.1%     6             Interpreter
      0.1%    10             Compilation
     
     
    Flat profile of 0.01 secs &#40;1 total ticks&#41;&#58; DestroyJavaVM
     
      Thread-local ticks&#58;
    100.0%     1             Blocked &#40;of total&#41;
     
     
    Global summary of 116.81 seconds&#58;
    100.0%  7477             Received ticks
      0.1%     9             Received GC ticks
      0.1%    10             Compilation
      0.1%     4             Class loader
      0.1%     6             Interpreter
    Voilà... 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...

    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.

  2. #2
    Expert éminent
    Avatar de GrandFather
    Inscrit en
    mai 2004
    Messages
    4 587
    Détails du profil
    Informations personnelles :
    Âge : 53

    Informations forums :
    Inscription : mai 2004
    Messages : 4 587
    Points : 7 103
    Points
    7 103
    Par défaut
    Bonjour,

    à part te conseiller de faire ta transformation en local et de copier le résultat sur le réseau, je ne vois pas trop comment, en intervenant au niveau de Xalan, on peut améliorer cela...
    FAQ XML
    ------------
    « Le moyen le plus sûr de cacher aux autres les limites de son savoir est de ne jamais les dépasser »
    Giacomo Leopardi

  3. #3
    Membre régulier
    Inscrit en
    janvier 2006
    Messages
    120
    Détails du profil
    Informations forums :
    Inscription : janvier 2006
    Messages : 120
    Points : 88
    Points
    88
    Par défaut
    Merci GrandFather,

    Effectivement, j'avais pensé à faire comme tu me le conseilles, mais il se poserait alors des problèmes de confidentialité (si pour une raison X ou Y le traitement crashe une fois le fichier créé sur le disque dur, et que ce fichier y reste, trop de monde y aurait accès...).

    Mais je me demandais surtout si ce comportement était normal... J'ai l'impression que Xalan écrit octet par octet dans le fichier, ce qui me surprend un peu...

    Merci encore!

  4. #4
    Expert éminent
    Avatar de GrandFather
    Inscrit en
    mai 2004
    Messages
    4 587
    Détails du profil
    Informations personnelles :
    Âge : 53

    Informations forums :
    Inscription : mai 2004
    Messages : 4 587
    Points : 7 103
    Points
    7 103
    Par défaut
    En principe, Xalan génère un arbre complet de résultat avant de sérialiser les données... C'est peut-être en rapport avec la façon dont la classe Process fonctionne, tu devrais essayer en écrivant un petit code Java utilisant TraX pour voir si les performances sont les mêmes.
    FAQ XML
    ------------
    « Le moyen le plus sûr de cacher aux autres les limites de son savoir est de ne jamais les dépasser »
    Giacomo Leopardi

Discussions similaires

  1. problème écriture sur un fichier
    Par drinkmilk dans le forum MFC
    Réponses: 4
    Dernier message: 24/06/2007, 00h08
  2. Lecture / écriture sur un port com
    Par dorian833 dans le forum C++
    Réponses: 7
    Dernier message: 07/07/2005, 15h20
  3. [MFC] Notification d'écriture sur le disque
    Par Yellowmat dans le forum MFC
    Réponses: 1
    Dernier message: 28/06/2005, 12h00
  4. PB d'écriture sur MSSQLServer à partir d'un service
    Par Dunsany dans le forum Bases de données
    Réponses: 31
    Dernier message: 21/08/2004, 15h25
  5. droits en écriture sur le réseau
    Par julien20vt dans le forum MFC
    Réponses: 4
    Dernier message: 25/03/2004, 11h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo