Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExpandableDirectByteBuffer maximum capacity only 1GB #272

Closed
spiritlcx opened this issue Jan 29, 2023 · 6 comments
Closed

ExpandableDirectByteBuffer maximum capacity only 1GB #272

spiritlcx opened this issue Jan 29, 2023 · 6 comments

Comments

@spiritlcx
Copy link

maximum capacity of ExpandableDirectByteBuffer is only 1GB
I think the reason is that the type of index is int
Do you think it's better to change int to long and expand the capacity?

image

@mikeb01
Copy link
Contributor

mikeb01 commented Jan 29, 2023

This would require changing all of the accessor methods that take in a index value and switch it from a int to a long. This in turn would break compatibility with the array backed implementations of the DirectBuffer.

@mikeb01 mikeb01 closed this as completed Jan 29, 2023
@clayly
Copy link

clayly commented Mar 9, 2023

This would require changing all of the accessor methods that take in a index value and switch it from a int to a long. This in turn would break compatibility with the array backed implementations of the DirectBuffer.

What do you think, are there other pitfalls besides compatibility that prevent the increase in the maximum size? Only this limitation does not allow using Aeron in our project, where the buffer size must be at least 60 gigabytes.

@mjpt777
Copy link
Contributor

mjpt777 commented Mar 9, 2023

ByteBuffer and byte arrays cannot be larger be larger than int capacity.

@clayly
Copy link

clayly commented Mar 9, 2023

ByteBuffer and byte arrays cannot be larger be larger than int capacity.

That is, if Argon would like to support a ring buffer of this size, then the only option is to work with files directly (memory-mapped files, dev/shm, etc.)?

@mjpt777
Copy link
Contributor

mjpt777 commented Mar 9, 2023

ByteBuffer and byte arrays cannot be larger be larger than int capacity.

That is, if Argon would like to support a ring buffer of this size, then the only option is to work with files directly (memory-mapped files, dev/shm, etc.)?

Mapped files in Java still return a ByteBuffer so still not possible. There are techniques that can be used which are unsupported in the JDK. We can provide commercial consulting on that but we do not provide it as free support in Agrona.

@vyazelenko
Copy link
Contributor

First of all as pointed out @mjpt777 the underlying size cannot exceed int (an actual value is Integer.MAX_VALUE - 8). That being said we could allow ExpandableDirectByteBufferto grow until that max value as oppose to 1GB.

If you need more than 2GB of storage you can use org.agrona.concurrent.MappedResizeableBuffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants