You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-42Lines changed: 24 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,16 @@
1
1
# Standard Network Library
2
-
High Performance, easy to use network library supporting 16k+ concurrent clients.
2
+
High Performance, easy to use network library supporting 16k+ concurrent clients on all provided topologies.
3
+
Designed for distributed realtime concurrent applications over LAN or Internet.
3
4
</br>Provides infrastructure for high throughput message passing, P2P, Nat Traversal, Reliable Udp.
4
-
</br>This repository consist of main core assembly and several serialization spesific implementation assemblies.
5
+
</br>This repository consist of main core assembly and several serialization spesific sub assemblies.
5
6
## Core Network Library
6
-
Network Library, which is the core of entire network library. It has all the logic associated with the network system and sub systems, starting from raw bytes to abstractions such as P2P lobbies. It provides generic templates to be used with any serialization methodology.
7
+
Network Library, which is the core of entire network library. Includes all logic associated with the network systems, starting from raw bytes to abstractions such as P2P lobbies. It provides generic templates to be used with any type of serialization.
7
8
8
9
### Core Components
9
-
Plug&Play high performance models, working with raw bytes.
10
+
Plug&Play mature high performance models, working with raw bytes. Also used as base for complex abstracted models.
10
11
-```Tcp Server/Client model``` with dynamic buffering and queueing sub systems, bytes can come fragmented like regular sockets.
11
12
-```Tcp Byte Message Server/Client``` where bytes are sent with 4 byte lenght header. It ensure atomic message delivery without fragmentation.
12
-
-```Udp Server/Client```standard udp with optimised for performance.
13
+
-```Udp Server/Client``` udp system where a server is emulated with optimised for performance.
13
14
-```Reliable Udp Client/Server``` where modern TCP protocol is implemented over Udp.
14
15
- Secure variants of all of the above(SSL with TLS for Tcp, Symetric Key AES for Udp).
15
16
@@ -20,24 +21,26 @@ Involves generic models which can work with any serialization protocol.
20
21
-```P2P Relay Client/Server``` where Peers(Clients) discover each other via Relay server, can use Udp/Rudp/Tcp to communicate. Supports Udp Holepunch.
21
22
-```P2P Room/Lobby Server/Client``` extention of Relay model where peers can define a room, similar to game matchmaking servers.
22
23
23
-
### Low Level Features
24
+
### Internal Features
25
+
#### Message Buffering/Queueing
26
+
- Tcp models a buffering/queueing system is implemented. This system is activated only during high load.
27
+
In a nutsell, if the socket is busy sending, next messages are buffered/queued and stiched together. When the socket becomes available again, sent as batch. Its like Naggle, but without sacrificing the fast sends on moderate/low traffic.
28
+
- This improves the throughput of small messages quite significantly (1000 fold compared to naive sends) as shown on benchmarks.
24
29
25
30
#### Advanced Memory Management
26
31
- Library implements "Shared Thread Local Memory Pool", where all byte arrays and the stream backing buffers are rented from. Memory is weak referenced. Pool allows minimum number GC cycles and automatically trims on system memory pressure.
27
32
- As an example, RelayServer can relay 21 Gigabyte/s Udp traffic using 36 mb process memory with 0 GC Collects.
28
-
29
-
#### Message Buffering
30
-
- Tcp models a buffering/queueing system is implemented. This system is activated only during high load.
31
-
In a nutsell, if the socket is busy sending, next messages are collected and stiched together and sent as batch when the socket becomes available again. Its like Naggle, but without sacrificing the fast sends on moderate traffic.
32
-
- This improves the throughput of small messages quite significantly as shown on benchmarks.
33
33
34
-
Library is tested with as many clients as OS(Windows) supports (around 16k dynamic ports). Data reliability(includung RUDP) is tested over the internet extensively.
35
-
Nat Traversal Udp holepunching is also tested over the internet with great success.
34
+
#### Build In Serialization
35
+
- Library provides high performance binary encoders for primitivish* types and employs static srialization for internal message types and carrier classes with smallest possible byte size.
36
36
37
-
Note: Libary has unsafe code and stack allocations. But these parts are well tested and not subject to change.
37
+
Library is tested with as many clients as OS(Windows) supports (around 16k dynamic ports). Data reliability includung RUDP is tested over the internet extensively.
38
+
Nat Traversal Udp holepunching is also tested over the internet with success.
39
+
40
+
Note: Libary has unsafe code and stack allocations. Unsafe sections are well tested and not subject to change.
38
41
39
42
## Sub Assemblies
40
-
Generic models from main assembly are implemented with the spesific serializers.
43
+
Generic models from main assembly are implemented with the spesific serializers. All method signatures and usage are identical.
41
44
It includes:
42
45
- Protobuf-Net
43
46
- MessagePack
@@ -77,9 +80,9 @@ Infinite Echo benchmarks are done by sending set of messages to server and getti
77
80
|Mumber Of Clients|Protobuf Echo per Second|Secure Protobuf Echo per Second|
78
81
|---|---|---|
79
82
|100|9,440,000|8,050,000|
80
-
|1000|8,380,000|7,980,000|
81
-
|5000|8,360,000|7,950,000|
82
-
|10000|8,340,000|7,890,000|
83
+
|1000|8,780,000|7,480,000|
84
+
|5000|8,360,000|7,390,000|
85
+
|10000|8,340,000|7,350,000|
83
86
84
87
#### Note
85
88
This benchmarks is only sending message envelope with raw byte payload. For serialization spesific performance please refer to:
@@ -186,30 +189,9 @@ Declare your type:
186
189
```
187
190
## MessageProtocol Server/Client
188
191
189
-
Message protocol is something I came up with to wrap all types of messages with a standard header.
190
-
It is an extention of Pure Message Server/Client. Difference here is we have ```MessageEnvelope``` As a Carrier/Metadata/Header class.
191
-
```MessageEnvelope``` is serialized Statically, independently of serialization protocol.
192
-
As for the reason for it, please refer the document [SerializationBenchmarks](SerializationBenchmarks.md)
193
-
194
-
You can define a header, key-value pairs, as metadata and information about the payload.
195
-
Most importantly the Payload propery of the envelope carries the Inner message bytes.
196
-
```UnpackPayload<T>()``` will deserialize the message on your type from the payload bytes.
197
-
198
-
It can also be raw bytes coming from some source (i.e. jpg image). Which you can set it by MessageEnvelope.SetPayload() method on the sender side.
199
-
You cant send both raw bytes and an serializable inner message with same envelope, Inner message will overwrite your payload.
200
-
This bytes are volatile (will be overwitten once code leaves the stack) unless you call LockBytes() method or copy manually. (important if you store it somewhere)
201
-
202
-
203
-
Its a simple implementation of a generic class from Standard Library.
0 commit comments