Comments (8)
cc @NiteshKant as this is similar to what we have been discussing for ReactiveIPC.
from rsocket-java.
@tmontgomery and I were discussing the approach used in Agrona that Aeron uses.
from rsocket-java.
Will have to see if Agrona UnsafeBuffer
can wrap a Netty ByteBuf
. That would be the easiest if possible.
from rsocket-java.
If the intended buffer API in reactive socket is an interface, then I think i can make netty work in a way that instead of netty's ByteBuf we can have a ByteBuf impl that additionally implement our interface and we don't need to do an additional object allocation for wrapping per ByteBuf use.
from rsocket-java.
I think there are two pretty viable options. Agrona has a read-only and a read-write interface for accessing by index into a buffer. The interfaces are:
- https://github.com/real-logic/Agrona/blob/master/src/main/java/uk/co/real_logic/agrona/DirectBuffer.java
- https://github.com/real-logic/Agrona/blob/master/src/main/java/uk/co/real_logic/agrona/MutableDirectBuffer.java
Implementing a concrete class for MutableDirectBuffer
to netty ByteBuf
should be straight forward.
Alternatively, it might be easy to add a new wrap function for UnsafeBuffer that can take a ByteBuf
. This is simpler and also provides all the concurrent operations as well.
Either of these is pretty straight forward to do and gives appropriate data layout access.
from rsocket-java.
I see this Buffer
abstraction we will have, show up in a few places:
- Inside the currently existing
Message
abstraction to get the frame data. - Inside the client/server protocol classes for initiating different request types in some form.
- For any generic encoder/decoder we write. eg: we will write an encoder/decoder for the payload data which will help to be generic, irrespective of which underneath network library we use.
Thus, I see the usage to be internal and external and so I would say we do not use an external library (agrona in this case) to represent that abstraction. We can pick the methods that makes sense from agrona and netty and define a Buffer
abstraction which can eventually be defined in ReactiveIPC.
Once we have this interface, it is certainly possible to have an implementation for netty which will eliminate copying or wrapping of the underlying ByteBuf
per use.
from rsocket-java.
Whether it be Agrona or not, it will need to support a few things for completeness (learned from developing Agrona buffers):
- means to
wrap
with no allocation:byte[]
(part of interface)java.nio.ByteBuffer
(including direct) (part of interface)- netty
ByteBuf
(left to concrete impl) - Optional: off-heap array (left to concrete impl)
ByteOrder
ing optionality withnativeOrder
default. (part of interface)- Java primitives (int, long, float, double) at an arbitrary index. (part of interface)
- buffer put/get at an arbitrary index to/from any form supported by
wrap
above. (part of interface) String
encode/decode at an arbitrary index with lengthByteOrder
. (part of interface)- Optional: access via
Unsafe
and ability to disable per access bounds checks.
from rsocket-java.
We chose ByteBuffer for better-or-worse.
from rsocket-java.
Related Issues (20)
- Ability to limit number of open requests at transport level
- CompositeByteBuf memory allocation for Frame messages HOT 1
- Ability to store session object inside RSocketRequester chain HOT 1
- About JWT authentication and authorization HOT 1
- How to set SETUP setupRoute
- SendUtils onDiscard handler class cast exception HOT 5
- https://maven.pkg.github.com/rsocket/rsocket-java (needs permission to access) HOT 1
- Tcp Example Server and Client in Seperate files doesn't work HOT 5
- NoSuchFieldError: rsocket-core overrides dependency for netty-buffer and therefore clashes with reactor-bom / reactor-netty HOT 2
- ClosedChannelException making RSocket request with invalid credentials HOT 1
- Bump reactor-bom to 2020.0.24 to fix CVE in reactor-netty HOT 2
- 1.1.4 Regression - RejectedSetupException on auth failure results in ClosedChannelException HOT 3
- Releasing memory in ZERO_COPY mode.
- Ongoing flux subscription is not getting cancelled even if the client is closed
- LoadbalanceRSocketClient lacks reconnection and retry functions HOT 1
- Send a message to an already established request-stream connection from the rsocket-server to all signed rscoket-clients except one
- How to keep RSocket connection alive forever. What should be configuration values for keepalive(interval, maxLifeTime) to achieve this? HOT 1
- Update "Supported Core Protocol Features Matrix" to add that Resumption is supported
- Server does not close and re-connect on no keep alive ack issue.
- Rsocket error "java.lang.IllegalStateException: Source has to be ASYNC fuseable" with Spring boot 3.2.x & JDK17 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rsocket-java.