Comments (23)
from pipelines.sockets.unofficial.
I did.
To make it work in general it requires just a single line change:
Needs to be changed to this:
var buffer = _receiveFromSocket.Writer.GetMemory(this._receiveOptions.MinimumSegmentSize);
And ZeroLength reads must not be used.
But overall it didn't perform very well due to the frequent flushing (= after each receive).
With UDP, the data doesn't get accumulated in the buffer. You get a single datagram with each receive call. And that causes too many async calls which are becoming a performance issue with high data rates.
from pipelines.sockets.unofficial.
I'll be honest as a big user of UDP and a user of pipelines I had considered it. However as Marc said it doesn't make a lot of sense in this case, you completely lose the framing of the datagram so then you need to implement framing over the top, at which point I question if you are rewriting tcp over UDP.
from pipelines.sockets.unofficial.
No, the framing doesn't get lost as mentioned above because in case of UDP you always get a single datagram with each receive call. In my case, a datagram contains n packets of size x with x being a global constant. Packets are not sliced across datagrams.
Maybe I should say that this is about media streaming. Several protocols in this area are UDP based and the challenge is to find the most effective implementation.
Arguing about protocol design and choice is a dead end in this case.. :-)
from pipelines.sockets.unofficial.
To me, UDP seems more like a Channel<ReadOnlySequence<byte>>
. Perhaps that's something that we could implement with minimal work, giving you all the benefits without the pain, and respecting the framing differences between UDP and TCP.
Happy to explore that area. I've mostly been TCP focused, but I love expanding my horizons...
from pipelines.sockets.unofficial.
Which was exactly the discussion I had with Fowler around UDP. I suspect it's not on the pipelines asp.net radar yet either (maybe quic will change that)
from pipelines.sockets.unofficial.
What do you mean by Channel<ReadOnlySequence> ?
Wasn't 'Channel' the initial term before it became 'Pipeline'?
from pipelines.sockets.unofficial.
System.Threading.Channels made around the same time as pipelines (which maybe why pipelines was renamed... But that's just a rumour 😀)
from pipelines.sockets.unofficial.
Channel<T>
is the high perf reader-writer async queue thing. Yes, the name was also the early name of pipelines, but pipelines lost and became pipelines. Related and overlapping topic, and I do think it would make a good API here, for packet-based rather than stream-based protocols.
from pipelines.sockets.unofficial.
That sounds really interesting, every time I read about channels somewhere I thought it was about the early pipeline stuff.
Too bad that it doesn't seem to support netstandard2.0 (need to support BSD as well)
from pipelines.sockets.unofficial.
Channels and pipelines are both netstandard 1.3+; you're fine
from pipelines.sockets.unofficial.
So, it's not yet documented as such?
Or is that the wrong place: https://docs.microsoft.com/en-us/dotnet/api/system.threading.channels.channel-1?view=dotnet-plat-ext-2.1&viewFallbackFrom=netstandard-2.0
from pipelines.sockets.unofficial.
Nuget: https://www.nuget.org/packages/System.Threading.Channels/ - click dependencies
from pipelines.sockets.unofficial.
Thanks a lot, I'll look into it!
from pipelines.sockets.unofficial.
In fact, maybe a case could be made for IAsyncEnumerable<ReadOnlySequence<byte>>
- I will have to play!
from pipelines.sockets.unofficial.
Think about small packet sizes and a huge amount of them :-)
from pipelines.sockets.unofficial.
Don't forget to add a running number when sending udp datagrams for testing.
You need to make sure that you're getting them all.
Mine are about 25k size, I tried to get close to half of the maximum allowed (64k).
The smaller I made the datagrams the worse it got (CPU usage).
(it's a real world application - that means: half datagram size => double amount of datagrams per time)
PS: Watch your e-mail, I can provide some more interesting details if you wish
from pipelines.sockets.unofficial.
Started a spike with this. Looking viable. A running number in the lib would be pointless - it can't tell if it didn't get a packet. Hence IMO any running number must be part of your payload, not the code that makes things work.
If you mean a running number in test code: sure, absolutely.
from pipelines.sockets.unofficial.
Yes, of course I meant a number inside the payload for testing.
from pipelines.sockets.unofficial.
Did anything come of this discussion? I can see a UDP branch but it doesn't seem like it ever got merged into master. Was an alternative to that branch implemented instead? Thanks
from pipelines.sockets.unofficial.
from pipelines.sockets.unofficial.
Ok, cool thanks.
from pipelines.sockets.unofficial.
The TCP protocol performs very badly in the case of a wide geographical distance around the world.
UDP is controlled by appropriate high-level algorithms to achieve an ideal low latency.
from pipelines.sockets.unofficial.
Related Issues (20)
- High CPU due to lock contention on _queue in DedicatedThreadPoolPipeScheduler.Schedule HOT 6
- Xamarin.Android crash with native exception on SocketConnection.Create HOT 2
- TLS/SSL support HOT 6
- How to find out when/if the reader/writer completed HOT 3
- Does this project only support .Net Core, instead of .Net Framework? HOT 8
- if the implementation of this library has relation ship for Rio(Winsock registered I/O extensions) in Windows? HOT 2
- Unable to wait for socket closure HOT 2
- Test: MutexSlim_ConcurrentLoadAsync_DisableContext - fails on my machine
- Test: ConnectTests.Connect - Fails on my machine HOT 1
- Test: BufferWriterDoesNotLeak also fails on my machine
- Set unsafeSuppressExecutionContextFlow on SocketAsyncEventArgs HOT 3
- Loopback fast path is deprected on Windows and can cause high cpu on Win Server 2019 HOT 2
- How do I flush synchronously? HOT 5
- Pump a pair of PipeReader/PipeWriter
- Investigating SemaphoreSlim on net6.0+ HOT 1
- Unnecessary _queue.Count check in DedicatedThreadPoolPipeScheduler.RunWorkLoop HOT 7
- netstandard2.1 DoReceive fails on Zero Length Reads on Mono HOT 1
- Thread Safety Violation Warnings found by InferSharp static analysis tool HOT 3
- Trim and AOT warnings in Delegates and PerTypeHelpers HOT 3
- Fix Thread Safety and other static code analysis issues reported by Infer#
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 pipelines.sockets.unofficial.