mucaho / jnetrobust Goto Github PK
View Code? Open in Web Editor NEWFast, reliable & non-intrusive message-oriented virtual network protocol for Java 6+.
License: Mozilla Public License 2.0
Fast, reliable & non-intrusive message-oriented virtual network protocol for Java 6+.
License: Mozilla Public License 2.0
I know it's only used in the samples bit 2.4 is pretty old at this point.
Is this library suitable for high latency and unreliable network connections?
How is reliability accomplished? Is it an ACK or a NACK based system?
As this library is also intended to work on Android, performance should be optimized where applicable
ack/last ack
fields) for multiple for retransmitsController.send(Collection<MultiKeyValue>): Packet
Controller.receive(Packet with Collection<MultiKeyValue>): Object
Packet
, MultiKeyValue
, Iterator
and co instead of instantiating new objectsinitialCapacity
parameters during collection initializationCurrently only basic congestion control is done when retransmitting packets. No congestion control is performed when sending new packets.
The problem is that the application is "in control", as it pushes/pulls data to/from the protocol. The protocol should not delay sending of packets due to highly congested network; It should inform the application about the current status of network congestion and let the application decide how much to throttle amount of data / rate of data that is being send. (e.g. Protocol.getCongestionFactor(): double
-> if its greater than 1
, application could send more data -> if its less than 1
, application could send less data).
Investigate existing congestion control algorithms - look at their characteristics
preferably use the ones which do not send extra metadata about network congestion; preferably use the ones that consider RTT, RTT variance, (estimated) packet loss, the form of the lastTransmissionAcks
field and the offset from sender side transmissionId
and received transmissionAck
(as well as the history of this offset - mean/deviation); preferably use the ones which are a bit more aggressive:
Notes on form of the lastTransmissionAcks
vector field:
vector v
v[i] = {0, 1} ... 0 = acked, 1= notAcked
i โฌ {0, n}, 0 is most recent, n is oldest transmissionAck
:
Investigate fast retransmit -> resend packets that are missing in lastAcks
field: this could work if we send at @ 10 Hz (every 100ms), but does not make sense if we send @ 120 Hz (every 9 ms), as due to jitter many packets get send before the out of order packet arrives -> ADDED
Benchmark the performance (latency, throughput, protocol overhead) vs TCP in multiple combinations of following factors:
Make sure to benchmark also on real connection over INet
JArrayLiterals
& Java UDP Wan Emulator
to GitHub OR submit to maven central and -> then add dependency to JArrayLiterals
& Java UDP Wan Emulator
JNetRobust
Add a fully-fledged example (using Kryo
serializer and DatagramSocket
s) to showcase usage. Make sure to include multiple protocol instances between the two hosts (add protocolId
field).
DefaultHost
which configures most of the stuff automatically (with DatagramChannel
, Buffer
, and default behaviour for protocol - show only received and ordered, throw Exception
if very bad network conditions, e.g. packet retransmitted 5 times or pendingMap
/receivedMap
too full)DefaultHost
)Add Travis CI to the project. Follow the guide
Make sure the user can only access API and not access or modify inner workings: (e.g. Packet.setData
)
Add documentation:
ProtocolListener.handleUnordered
better (it's actually unreceived data that gets skipped over, the argument is the first data after the "gap")jnetrobust-samples
Packet
& MetaData
MetaData
to Segment
, to be in line with ISO/OSI terminology analogue to Packet
, update Wiki16
should be fineAdd additional tests to improve test coverage:
Controller
(data & packet as input)ReceivedMapControl.removeEntry
as its not trivialSimpleMapControlTest.testDiscardTimedoutEntries
& SimpleMapControlTest.testDiscardEntryTooOften
PrimitiveValuesTest
pendingMapSize
& receivedMapSize
is empty in DelayedTest
[0] 40, 60000, 0.75, 0.25, 16, 1000, true (testDelayed)(com.github.mucaho.jnetrobust.DelayedTest) Time elapsed: 1,472.111 sec <<< ERROR!
java.lang.NullPointerException
at com.github.mucaho.jnetrobust.controller.Controller.receive(Controller.java:92)
at com.github.mucaho.jnetrobust.controller.Controller.receive(Controller.java:86)
at com.github.mucaho.jnetrobust.util.TestHost.consume(TestHost.java:73)
at com.github.mucaho.jnetrobust.util.TestHost.receive(TestHost.java:64)
at com.github.mucaho.jnetrobust.util.TestHost.receive(TestHost.java:59)
at com.github.mucaho.jnetrobust.DelayedTest.testDelayed(DelayedTest.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:606)
at junitparams.internal.InvokeParameterisedMethod.evaluate(InvokeParameterisedMethod.java:209)
at junitparams.internal.ParameterisedTestMethodRunner.runMethodInvoker(ParameterisedTestMethodRunner.java:49)
at junitparams.internal.ParameterisedTestMethodRunner.runTestMethod(ParameterisedTestMethodRunner.java:42)
at junitparams.internal.ParameterisedTestClassRunner.runParameterisedTest(ParameterisedTestClassRunner.java:143)
at junitparams.JUnitParamsRunner.runChild(JUnitParamsRunner.java:393)
at junitparams.JUnitParamsRunner.runChild(JUnitParamsRunner.java:371)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
PendingMapControl.removeFromPending
work with long as lastAck
parameter -> also use BitConstants.convert
to convert between int and lngprotocol.send(T... datas)
Protocol.compare(id1, id2)
to static methodId
opaque handles instead of shortsK
and G
RTO parametersallocateDirect
for buffersDefaultHost.register(SocketAddress, DataClass)
which instantiates new Protocol
instance for that address -> actually also allow adding multiple protocol instances per SocketAddress to allow one instance with transmission and one w/o -> reuse serialization and network channel -> do multiplexing based on first byte protocold
to (receive) & based on SocketAddress-to-send (send) to different Protocol
instances -> adapt Synchronization
example to work with this -> no need to use protocolId
, just use different portsProtocolHost
, as different ProtocolHandle
s can have different user datas; figure out how to guarantee same order of UserData.class
kryo serialization registrations on multiple hostsServerSynchronizationController
after ordering or only newest instead?UPDATE_ON_INTERPOLATED_DATA
(interpol_rcvd &&/|| interpol_nwst &&|| interpol_ord) to Synchronization
examplehandleRetransmitData
to ProtocolListener
shouldRetransmit
is true then it reports already retransmitted datashouldRetransmit
is false then it's up to the application whether to retransmit or notshouldRetransmit
to autoRetransmit
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.