title: Apache Camel File Output Component Performance slow - Java
body: <p>I'm using Camel to write a number of strings (100,000s) to set of text files.</p>
  
  <p>The below code shows my Camel route:</p>
  
  <pre><code>from("seda:fileOutputMatchedMsgClose?concurrentConsumers=44")
  .to("file:MATCHED_CLOSE?fileExist=Append")
  .end();
  </code></pre>
  
  <p>So basically what's happening is I have a producer bean which is creating these strings from objects processed further upstream. I am setting the filename in the header as part of the producer bean's sendbody and header method. So I have 22 files which are being written to (all in the MATCHED_CLOSE folder). The messages for these 22 files are all being sent to the one SEDA endpoint (fileOutputMatchedMsgClose).</p>
  
  <p>The problem is the application sends around 440 strings to this SEDA endpoint a second. And looking at the queue size of fileOutputMatchedMsgClose in JConsole it just keeps growing along with memory usage. So it seems theres a bit of a bottle neck here. </p>
  
  <p>Would anyone have any recommendations on how to get better performance, the writing to the file each of the 440 lines is around 280chars, not very large at all. So I guess the question is are there any optimizations I can do to increase the performance of the file component in Camel (maybe make multiple routes for each file (which would be a pain) or should I just write my own file IO bean that handles this?</p>
  
  <p>Cheers!</p>