in reply to Re^2: Multithreaded xml writing using XML::Writer
in thread Multithreaded xml writing using XML::Writer
is it a good thing to use XML::Writer in a multithread fashion?
The way you are doing it, no.
Since both threads are writing to the same file, and they cannot safely both be writing at the same time, you would have to serialise them to prevent them intermingling their outputs. And that means there would be nothing gained by threading that paret of the process.
But, reading the subtext of your question, the gain you are hoping for is not in the writing of the XML output, but in the sourcing of the data written. That is to say, you imply that you are fetching data from two (or more) sources. As you do not show where or how you are sourcing that data, it is impossible to say whether there would be any advantage in using threading for that part of the process.
If, for example, you are fetching the data from two different servers, there may be some gains to be had by overlapping the fetching of the data, and then feeding the data fetched back to a single thread for writing to a file as XML.
But you'll need to describe the whole process from end to end to get good wisdom on that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Multithreaded xml writing using XML::Writer
by DreamT (Pilgrim) on May 03, 2010 at 12:18 UTC | |
by BrowserUk (Patriarch) on May 03, 2010 at 12:22 UTC | |
by DreamT (Pilgrim) on May 03, 2010 at 13:52 UTC | |
by BrowserUk (Patriarch) on May 03, 2010 at 15:38 UTC | |
by DreamT (Pilgrim) on May 04, 2010 at 07:07 UTC | |
|