I have a simple loop in my Crail java client to fetch the contents of a 1GB
file like so:

private CrailBuffer buf = null;
int bufsize = 1024*1024;
int filesize = 1024*1024*1024;
...
buf = OffHeapBuffer.wrap(ByteBuffer.allocateDirect(bufsize));
long sumbytes = 0;
while (sumbytes < filesize) {
   buf.clear();
   CrailResult cr = directStream.read(buf).get();
   long ret = cr.getLen();
   sumbytes = sumbytes + ret;
}

The namenode, datanode, and my java client are all running in the same
cloud VM.  When running, 100% (and more) CPU is consumed by my java app.  I
was expecting something close to zero.  Why so much CPU?  A consequence of
running in a VM or am I doing something wrong?

Lou.

Reply via email to