[xml] Need better XML writing performance



We need to increase performance of our XML data generating application. Our
app receives (during peak periods) as many as 5,000 binary messages per
second and converts them to XML using libxml2 and writes them to a file in
real time. Our environment is Sun Solaris 10. 

Profiling shows almost all the time is spent inside libxml2. 

For each message we receive, our code looks something like this: 

    Receive binary msg
    xmlBufferCreate()
    xmlNewTextWriterMemory()
    xmlTextWriterSetIndent()
    xmlTextWriterStartElement()
    xmlTextWriterWriteFormatElement()
    a bunch more calls to xmlTextWriterWriteFormatElement()
    xmlTextWriterEndElement()
    xmlFreeTextWriter()
    write buf->content to file
    xmlBufferFree()

Any help would be appreciated. Here are some specific questions: 

1. If we stay with libxml2, can the code above be improved? 

2. Is libxml2 mt-safe? We are running on a multi CPU platform, so we should
be able to improve performance by processing multiple messages concurrently.
Our app is not currently multi-threaded. If we change this so that we have
multiple threads each calling the above code, will libxml2 work ok? 

3. Is there another faster XML writer that is faster than libxml2? 

Thank you. 

Bob Noble



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]