6 ms·
Tasks and Parallel are available as first class citizens in the .NET framework. Large apis. Easy to cold start a good headache. It's not easy stuff. Difficult
by danielovichdk 3y ago
Tasks and Parallel are available as first class citizens in the .NET framework. Large apis. Easy to cold start a good headache. It's not easy stuff.
Difficult patterns to optimize for is my experience if any IO or network boundaries are in play. Even that and it sometimes seems the more knowledge on how threading works on one particular cpu architecture.
So for me at least, on a high level these patterns seem easy enough and seems to play well in to the popculcural small service fad and large data processing. But be aware of the underlying cpu architecture and threading and how thread pools work on your particular OS.
Oh yes and then comes the debugging and reading the code part, which we all know are where the real efforts of time comes to play.
Use these when absolutely no other options are available. Just like multithreading.
- Fellshard 3y agoWhen I used those libraries in .NET, they simply did not function, for unspecified reasons. I boiled it down to the smallest possible example, based on their docs, and data simply never made it through the flow at all. It was baffling to me, but not an uncommon experience with various components of the core of .NET (not to be confused with .NET Core).
- neonsunset 3y agovar task1 = service.DispatchFirst(param1); var task2 = service.DispatchSecond(param2); var final = service.DispatchThird(await task1, await task2); or var queries = users.Select(user => FetchPurchases(user.Id)); var results = await Task.WhenAll(queries); Very easy. As long as you don't touch System.Threading.Tasks.Dataflow namespace, everything will be good.
- victor106 3y agoAnyone know of these are available in the Java world?
- lloydatkinson 3y agoActually so is data - TPL Dataflow.
- rawoke083600 3y agoAgreed ! This looks complex but maybe cause I'm not in the .NET world ? Noob question: Can 90%+ of the "effect" from the above not be replicated or be done with Go-Lang's CSP (or another language that also uses CSP) ? Is Golang or CSP model perfect ? Of course not, but It it is "relatively" easy to reason about compared to "catalogue of other options" ?