This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Has anyone experienced longer response time with cached XML file, read by a script on the page?
I have a java class that uses JDOM to generate the necessary XML file when the application first loaded. The remaining calls to the jsp page suppose to be fast since the xml sits on the cache. However the response time`s got really slow after I generate the page with java class instead of generating it in the jsp page itself. Jsp calls the java to ge the xml back
One of the possible thing might be the Flash on ht ejsp page that reads the xml file as its input. Can this be really a reason of the late respond?
Or, am I making a mistake by sending the XML file as a static string object?
Here is what I have from the highest level:
* Create the Document object with its required structure * Read this Document object into XMLOutputter object as a string: String _str = XMLOutputter.ouputString(doc); * Return the _str from a static method * jsp calls the static method, recieves the _str object and the script in the jsp reads the recieved _str.
I`d like to hear from you if you see a problem with this.
* Read this Document object into XMLOutputter object as a string: String _str = XMLOutputter.ouputString(doc); * Return the _str from a static method
Unless the Document is going to be modified dynamically for every query, you should just keep the String to be served without going through the very time consuming Document -> String conversion every time. You might even discard the Document entirely - that data structure consumes a LOT more memory than the plain String representation.
Joined: Oct 02, 2006
Thanks for the reply. So, are you recommending reducig the JDOM implementation and use String buffering instead of Document object creation? Since the xml is generated once, I thougth it would be faster to generate the page. I can see the xml file is sitting on the cache but my page takes very long time, like 20 minutes to show the content!! One clearification: Document --> String conversion happens only once. Keeping the String output is still a good choice then, right (in terms of memory)? May be I should focus on the Flash script?
Author and all-around good cowpoke
Joined: Mar 22, 2000
but my page takes very long time, like 20 minutes to show the content!!
Clearly something other than Java parsing or serializing is causing this delay. Delays like this are typically caused by some process attempting to make a network or database connection which eventually fails or just takes a really long time. It might be as simple as a request for images or video from a server that just isnt there.
If this was my problem I would try to create a bare-bones version with minimum requests for resources, then add back complexity.
If this is the current version of Flash, the latest SDK contains debugging versions of Flash player. I have not used them but there should be some way you can find out what is taking so long.
Joined: Oct 02, 2006
With your reply, I have better idea of where to focus on now. I`ll make sure about the images first becuase that really can be the issue I guess. If it is not the case I`ll see dig in the Flash scritp.. Great help, Thanks!