title: Creating and saving large XMLs in Java
body: <p>I am working on a java application whose job is to create and save XML (large size). The sample i got is 300 MB XML file. </p>
  
  <p>The app was designed to collect bulk data from the database and save it in XML format. The application because of its heavy IO and memory usage was designed to process MAX 3 such requests parallel. </p>
  
  <p>Now the requirement is to make it process up to 50 such requests parallel. The current app uses XMLbean to create the XML then saves it to the file system. The application is exposed as a web service on weblogic server (it's on a 64 bit OS and Java MAX Heap size id 4 GB). </p>
  
  <p>I need your opinion on:</p>
  
  <p>1) Is there an XML API that works with XSD and can be used to create large XMLs 200-200 MB with minimum overhead ? XMLbean works fine for us, but is there something that can handle it better ?</p>
  
  <p>2) What will be the best and most memory efficient way to save it to file system ? - i am thinking of changing the current writer to bufferedWriter and have it save 1024 bytes to memory before a physical write to disk happens. - Can there be any side effect to increasing it ?</p>
  
  <p>3) If there is no limit on technology choice and server etc - what will be the ideal solution !!!</p>
  
  <p>EDIT 1# The DB access is fast (about 5% of total time). The creating of XML is slow (takes 80%) of time. Saving it takes 15% (but there are a lot of improvements i see i can do so i am not worried about that). - Thanks Luis.</p>