1,521 karma · joined May 25, 2012 (14y ago) · 286 submissions
151.
Why is string.GetHashCode() different each time I run my program in .NET Core?(andrewlock.net ↗)
1 points · by algorithmsRcool · 7y ago · discuss
comment 7y ago · link · parent
Essentially this is a language agnostic framework for building data processing systems that are highly-avalible, distributed, topologically static (no dynamic scaling), and features exactly once processing.
You define a message handler that will always produce the same output sequence given the same input sequence and the framework provides delivery, serialization, buffering, durability and transparent recovery. They even provide a nice way of wrapping non deterministic behavior so that you can seamlessly continue even if you fail in the middle of processing a message.
That being said, the really are sloppy with their performance numbers, the comparison to gRPC isn't really fair at all due to their dynamic batching. And the code examples in the paper have some really silly errors.
But the paper is still a great introduction to reliable stream processing and basic strategies for delivering exactly once delivery.
Also, there is some interesting code that the paper glosses over in this repo: https://github.com/Microsoft/CRA
155.
Ambrosia: Robust Distributed Programming Made Easy and Efficient(github.com ↗)
24 points · by algorithmsRcool · 8y ago · 8 comments
comment 8y ago · link · parent
Im sure there is an example of connecting pipes together like this somewhere. Maybe in Kestrel or SignalR (Core)?
comment 8y ago · link · parent
But honestly, K8s has first class support from MS, Google, AWS. Has major buy-in from the community, good docs, plenty of recorded talks, presentations and war stories and a very active community.
SF has basically none of that. At the end of the day, SF isn't massively better than K8s for my use case and It would have to be to make up for all those disadvantages.
comment 8y ago · link · parent
Trying to get .net core app running on SF was extremely frustrating and confusing. K8s was a MUCH more natural experience.
I was really disappointed in the tooling. The sfproj files were this incomprehensible mess. If the ui didn't quite work you are hosed.
I would go on but I'm on mobile
comment 8y ago · link · parent
Channels does this but has 2 advantages.
1. It is built on the most up-to-date threading primatives (ValueTask) which gives it a perf advantage.
2. It's internal design is very simple and lightweight. BlockingCollection was designed to have swappable guts. Channels are single purpose.
The other nice thing is the channels API is really no nonsense super simple to get GREAT performance out of normal async/await. No tuning really needed. I got >300Krps out of a sequence of chained channels with a buffer size of 1.
comment 8y ago · link · parent
They had tuples, async/await, and match statements a decade ago and every time C# adopts one of their feature they change the implementation and make F# retool. It's kinda awful.
At this point I want F# to do a hard reset, rebuild on top of Roslyn, natively adopt ValueTuple and Task/ValueTask then grow alongside C# like VB tried to.
comment 8y ago · link · parent
...But reading between the lines, you probably still have clients on XP (.NET 4.0). That's gotta sting. We made a fuss about TLS1.2 support being required and forced them to upgrade to Win7/.NET 4.5.2 at least.
I have gotten gotten a smallish winforms app to work with the new .csproj format. But it's painful. WPF is probably a nightmare.
As an aside if you make it to .NET 4.5+ and get async/await. It works great with winforms and presumably WPF!
comment 8y ago · link · parent
https://gist.github.com/AlgorithmsAreCool/b0960ce8a3400305e4...
comment 8y ago · link · parent
Channel<T> uses ValueTask<T> which is kinda painful in F# for now.
comment 8y ago · link · parent
But it is pretty simple to use. It is in nuget package "System.Threading.Channels".
You basically call Channel.CreateBounded<T>(int) to create a channel that will buffer a limited number of T objects.
A Channel has a ChannelReader and ChannelWriter which are two ends of the same channel. The reader is the output side, the writer is the input side.
Each side exposes methods to synchronously try to Read or Write or asynchronously Read or Write (respectively).
It supports "Completion" meaning that the Writer can signal the Reader(s) that it is done writing forever. For example imagine you had a channel that was for Log Messages. A bunch of readers might be listening, but then the App shuts down. The writer can call "Complete()" on the channel and the Readers will get wake up and get a message that there is no more messages and flush themselves and shut down.
As a note you will need to run your own processing thread to await messages from the channel. Unlike Dataflow which will span it's own taks to handle messages.
I will write up an example Gist and reply to this thread in a little bit.
Other notes: - The API is very similar to Dataflow since Stephen Toub wrote them both. - It is extremely fast. I have seen > 1.25M messages per second in my benchmarks. - It is mostly allocation free due to using the new ValueTask<T> which is a struct
Futher Reading: https://www.nuget.org/packages/System.Threading.Channels/ https://apisof.net/catalog/System.Threading.Channels
comment 8y ago · link · parent
The real selling point is that Span is much more flexible than an Array. Both Managed and Unmanged memory can work with it. If you load a big string and need to get each line from it, you can slice into the middle of the string safely and get a ReadOnlySpan<char> that supports most 'string' operations without allocating any memory.
Or imagine you need to process some huge file, typically you would read it chunk by chunk copying the data from the Stream into some byte[]. But with Span you could open a Memory Mapped File and work on segments of the file without copying into temp buffers.
You gain a lot by avoiding memory copies and by allocating fewer objects (less work for the GC). For some workloads then can be a huge speedup.
comment 8y ago · link · parent
I've found it's a little tricky to get used to calling Slice() all the time. But it opens up so many doors for allocation reduction and perf improvement.
Also, it is so nice to not have to pass (array, offset, length) around everywhere
comment 8y ago · link · parent
The most important since at least framework 4.0 maybe even 3.0.
We are getting:
- Span<T>/Memory<T> : A 0-copy, unified way of accessing Managed or Unmanaged memory.
- Channel<T> : High performance thread-safe queues (like go channels)
- Pipelines : an async, 0-copy version of Stream
- In-box support for Array/Buffer pooling (finally!) (MemoryPool, ArrayPool)
- Better primitives for pointer manipulation and memory marshaling. (MemoryMarshal)
- New primitives for high performance parsers and formatters (System.Buffers.Binary and System.Buffers.Text)
- Improved support for SSE/NEON via Vector<T>
- Microsoft.Windows.Compatibility : Windows specific APIs on .NET Core (Registry, EventLog, NamedPipes...)
- Tiered Compilation
- Faster tooling
- Wider Platform support
If you write code on .NET, you should [Edit] evaluate this release with to see if it fits your business needs [/Edit]
Doubly so if you care about runtime performance.