XmlData: The results are in
After running three test runs of the XmlData sensor, I have gotten the sensor up and running. The three test run settings were:
- The default JVM heap size, which is 64ish MB.
- An increase of JVM heap size to 1024 MB with a manual invocation of System.gc() after each send to the sensorbase and after each file.
- An increase of JVM heap size to 1024 MB.
After I fixed the problem of loading the hashmap with duplicate entries, the sensor failed to finish sending data due to an Out of Memory Exception. After some investigation, I found that the sensor was failing when the largest file was unmarshalled. The largest file was 10 MB in size.
First Test Run with no increase in heap:
So what I decided to do was increase the heap size and found that the sensor completes. Great success! At 1:13, you can see the largest spike on the heap usage graph. That is the time when the 10 MB file was unmarshalled. With the increase in heap, the sensor had no problems.
For fun, I ran one last invocation of the sensor with out the manual System.gc() calls. It turns out that the sensor allocates around 26 more MB to send the same amount of data. It is interesting to note that at the end of the sensor process, the data is very small, but the sensor still uses the same amount of allocated memory. In the 2nd invocation, the heap usage graph shows that it only uses a minimal amount of memory.
I will need to document in the user guide to increase the heap size if sending large files. It might be a good idea to tell users to increase their heap to a large number. If we come across the case where a user has an abnormally large file, we may need to go the route that Philip suggested of writing a custom SAX parser. That will remove the need to load the entire document into memory.
The sensor is almost functional. I noticed that version 7 data includes pMap attributes, which I probably will need to separate. After thats completed, I can write some documentation and release! Hopefully I can send out a review request at the next milestone.
