title: JNI vs. JNA performance
body: <p>We have a native <code>c/asm</code> application utilizing GPU(OpenCL) for a big <code>encrypt/decrypt</code> data with a specific method, and it just works perfect, no problem. A part of the project (web and distribution) is been developing by <code>JEE</code>, and we just need to call native application/library.</p>
  
  <p>We have tried to call it as a separated-external process using <code>Process</code> class. The problem is that we cannot control the application(event, handlers, threads, etc...). We also tried to just switch the C code into Java code, but the performance died. Except running the native code as process, I'm thinking about JNA and JNI, but there are some questions.</p>
  
  <p><strong>Questions:</strong></p>
  
  <ol>
  <li>For better(faster) read/write solution, is it possible to exchange data by direct(unmanaged) memory  [Java(<code>ByteBuffer#allocateDirect()</code>)] in both JNI and JNA?</li>
  <li>Is it possible to manage and handle process by native code, and access the GPU(shared) memory through Java code(OpenCL lib)?</li>
  <li>What about performance? Is JNA faster than JNI?</li>
  </ol>
  
  <p>We have two AMD W7000 clustered device on Redhat Linux6 x64.</p>