You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@crail.apache.org by Lou DeGenaro <lo...@gmail.com> on 2020/02/21 19:35:02 UTC

plz help with buffer size

I have code that's based on what I see in
org.apache.crail.tools.CrailBenchmark.  The subject file to be fetched is
in crail DRAM and is 1GB in size.

String filename = "/G1.txt";
int bufsize = 1024*1024;
CrailBuffer buf = OffHeapBuffer.wrap(ByteBuffer.allocateDirect(bufsize));
CrailFile file = cstore.lookup(filename).get().asFile();
CrailInputStream directStream =
file.getDirectInputStream(file.getCapacity());

buf.clear();
CrailResult cr = directStream.read(buf).get();
long ret = cr.getLen();
ByteBuffer bb = buf.getByteBuffer();
bb.flip();
int rem = bb.remaining();

This works fine.  But if I change the bufsize to, say, 2*1024*1024 the
results are unexpected. ret is the expected 2*1024*1024 but rem is much
less, and there is no Exception thrown.

That is, it seems that the max buffer size is 1024*1024 bytes per read
request?

Please advise.

Thanks.

Lou.