The ResourceService was originally developed to send index segment files from one node to another when an index partition was moved. As part of the QUADS_QUERY_BRANCH it has been extended so that services may publish ByteBuffer objects containing intermediate results for distributed query processing. Both files and ByteBuffers are identified by UUIDs. Resource transfers currently use the InputStream and OutputStream interfaces for both files and ByteBuffers.
Java provides mechanisms for transferring data directly from one channel to another. Those mechanisms may be used to transfer the content of a file directly over a socket without moving the data through the JVM. This can result in a significant increase in the throughput of the transfer with a corresponding reduction in the resource demand (CPU, RAM, GC).
Likewise, Java provides mechanisms for directly transferring the contents of a ByteBuffer onto a socket channel -- in fact, this was the original purpose of the Java NIO facility.
The resource service should be modified to use NIO transfers for both files and ByteBuffers. This will improve the performance of the distributed query facility. It will also improve the stability of the distributed query facility by removing the high thread counts associated with large numbers of concurrent transfers among nodes.
@see https://sourceforge.net/apps/trac/bigdata/ticket/486 (NIO solution set interchange on the cluster)