4

I am building an "Application Virtualization" product. I use XML file as a virtual registry. Virtual applications generated from my software accesses the virtual registry Xml. It runs , however runs very slow.

I load and unload the XML on every Registry API calls, because multiple process threaded from the parent access a same registry file. This may cause the application to run slow.

Can any one let me know the alternative for XML...

Muthukumar Palaniappan
  • 1,622
  • 5
  • 25
  • 49
  • 3
    Why would you load it on every registry API call? The average application probably makes eleventy billion calls to the registry; this approach would be extremely slow. Why don't you just load it once at startup and then synchronize access to it with a reader-writer lock? – Luke Feb 12 '11 at 13:06
  • Initially I load once in the memory, access it, write it and on closing the application i save to the secondary memory back. BUt many application creates multiple process and tries to access the registry simultaneously. Once it comes to multiple process, registry loaded in the first process's main memory falls out of scope and not synchronized with other process. We need to have a common memory between the processes to do it. – Muthukumar Palaniappan Feb 12 '11 at 13:26
  • 1
    If I were to do something like that, I'd use a real (embedded?) DB... XML is not thought for speed. – Matteo Italia Feb 12 '11 at 14:20
  • If you need to synchronize it across multiple processes you should probably host the registry stuff in its own process (perhaps a service) and use IPC (perhaps named pipes) to access it from the virtualized processes. – Luke Feb 12 '11 at 16:59
  • Okie Luke, I dont depend on registry for writing code for virtual registry. Handling in service will result me to depend on registry. Not sure how this will work out. I will definitely analyse your solution. Thanks for your help. – Muthukumar Palaniappan Feb 14 '11 at 04:49
  • I usually use boxedapp in such cases. – John Smith Dec 22 '11 at 18:58

4 Answers4

1

You could use a database instead. It would be faster. Sqlite is lightweight and powerful.

Toby Allen
  • 10,997
  • 11
  • 73
  • 124
0

If you load it into memory and operate on it from there then your problem isn't XML. Profile your application to find out where it's spending most of it's time. I think you will probably find it's spending most of it's time searching for the item you want to access.

Jay
  • 13,803
  • 4
  • 42
  • 69
0

Its text to tree transformation time. I managed this in my code by Loadaing and Parsing the XML in all processes, only after a write has occured in any one of the process.

Muthukumar Palaniappan
  • 1,622
  • 5
  • 25
  • 49
0

Well, you could of course always use the real registry, which is thread-safe and fast...

Otherwise, you'd have to create a separate process that manages your virtual XML registry, keeping the XML structure in memory so it doesn't have to read/write it all the time. Then the processes that need to access it can use IPC to communicate with the registry process.

Another idea, if the multiple processes are not likely to update the registry all the time: keep your virtual XML registry in memory, and write it to disk when changed, but asynchronously via a background thread. When accessing the registry, first check whether the file has been changed; if not, you don't need to reload it.

Frederik Slijkerman
  • 6,471
  • 28
  • 39