Click here to Skip to main content
14,869,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am working on realtime web application. To improve the performace of realtime application i am using xml file insted of Database.The xml file is generated with the help of window service.This service will keep updating xml file. Its working fine but problem occures when you try to access same site on multiple instance.The data is not reflected in real time on every instance,means there is milliseconds/seconds delay to reflect data on every instance. Why this is happening?? I am using following code to read xml file.

DataSet dt_xml = new DataSet();
C#
using (XmlReader SR = XmlReader.Create(@"D:\Test\Debug_20620\Resources\RTFloatData.xml"))
           {
               dt_xml.ReadXml(SR);

           }
           dt = (from DataRow dr in dt_xml.Tables[0].Rows
                 where dr["p_TagID"].ToString() == TID.ToString()
                 select dr).CopyToDataTable();



What can i do,so that it will work fast or data reflect on every instance at a same time..
thanks in advance
Posted
Comments
Richard Deeming 21-Jul-15 9:04am
   
Do you have any performance measurements to show that the XML file is faster than a database, or did you just assume that it would be?

How does your code handle the case where you're trying to update the file whilst it's being read, or trying to read the file whilst it's being updated?
Member 11151142 21-Jul-15 10:15am
   
Actully i want to reduce the continuous Database connectivity from realtime module of web application because my windows service is doing this task. I have also observed the performance by XML file and by Direct DB connectivity. Xml file gives better performace than direct DB connectivity. But This performance is valid for only single instance. If you are try to access it on multiple instances then it gives some delay.In that case DB connectivity performs well.
My windows service is continuously update the xml file and also i have synchronised this file.

1 solution

Rather than use a URL to an XML file, I would create an API that returns XML content in each request.
So instead of your server recreate the XML periodically, it would only make when prompted.
You could do an internal cache control to create the XML only once every X seconds between each API call to prevent overload.

Sorry for my English. I read better than write.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900