Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new System.IO.Pipelines API / Project Bedrock #132

Open
bchavez opened this issue May 9, 2018 · 6 comments
Open

Use new System.IO.Pipelines API / Project Bedrock #132

bchavez opened this issue May 9, 2018 · 6 comments
Milestone

Comments

@bchavez
Copy link
Owner

bchavez commented May 9, 2018

Benefits

  • Pooled memory management reducing allocations.
  • Instead of current message pump design of pulling/pushing bytes out of a NetworkStream and using CancellationTokenSource; we can leverage some of the low-level network code that ASP.NET Core is using.
  • Should allow us to consolidate/delete a lot of code in SocketWrapper.cs.
  • Should help us get the best performance out of the driver from the network when implementing Investigate "t" Response Type Ordering for Crazy Fast Response Routing #77.

Disadvantages

  • Requires .NET Core 2.1 (I think)

References

@bchavez bchavez added this to the 2.4 milestone May 9, 2018
@cecilphillip
Copy link

Pipelines ships out of the box with Core 2.1, but I "think" you can pull in the NuGet package in .NET Standard 2.0 supported projects.

There's this package, but I haven't tried it yet.

@bchavez
Copy link
Owner Author

bchavez commented May 16, 2018

Thanks @cecilphillip ! The package link is really helpful. I didn't realize the package was on NuGet already.

After checking the Dependencies section on the NuGet page, I found it really intresting that Pipelines supports .NET Framework 4.6. Do you know if Pipelines really works on .NET Full Framework 4.6? I thought some of these Span<T> and System.IO.Pipeline optimizations required underlying support from the runtime? It would be really cool if it worked on 4.6 Full Framework.

chrome_1615

Thanks for dropping the info Cecil!

🚗 🚙 "Let the good times roll..."

@cecilphillip
Copy link

Looks like Span<T> can be made available in 4.6.1 via System.Memory which is a dependency of System.IO.Pipelines.

@bchavez
Copy link
Owner Author

bchavez commented May 17, 2018

Thanks @cecilphillip .

Also, found some additional info:
http://adamsitnik.com/Span/#how-does-it-work

How does it work? There are two versions of Span:

  • For the runtimes existing prior to Span.
  • For the new runtimes, which implement native support for Spans.

https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md#designrepresentation

We will provide two different implementations of Span:

  • Fast Span<T> (available on runtimes with special support for spans)
  • Slow Span<T> (available on all current .NET runtimes, even existing ones, e.g. .NET 4.5)

Seems like, as far as the runtime is concerned, there are two versions of Span<T>, 1) one for runtimes that have native Span support (eg .NET Core) and 2) one for older runtimes that don't have native support (eg .NET Full Framework 4.6). I'm guessing having two different Span<T> implementations is how Span<T> is made compatiable with older runtimes.

@francisminu
Copy link

@bchavez Hi Brian,
Our project is in .NET framework 4.6.1.
So are you stating that System.IO.Pipelines cannot be used in 4.6.1 and works as intended only in .Net core 2.1?

Any inputs would be really helpful. I have been trying a few demos, but all of them stops me at some step where the given method is not available in 4.6.1.

Thanks!

@bchavez
Copy link
Owner Author

bchavez commented Aug 1, 2018

Hi Minu,

My current understanding is that System.IO.Pipelines should work in both .NET Core and Full Framework (4.6.1). I have not personally tried System.IO.Pipelines in either runtime yet.

The only difference is when your app (or its dependencies) use the namespace System.IO.Pipelines on .NET Core, the runtime is better optimized for System.IO.Pipelines Span operations. The links I've posted above should contain enough background information about the System.IO.Pipelines implementation.

The only thing I can suggest is making sure all your dependencies are up to date. Even go so far as testing Full Framework 4.7.2 and see if it works there. If it still doesn't work then, I wouldn't have the slightest clue... something else must be wrong.

The discussion here is mostly reserved for System.IO.Pipelines as it relates to the C# RethinkDB driver. If you need more help, maybe posting a question on Stack Overflow or .NET's Slack channel might help. But thanks for giving us the heads up to double check the 4.6.1 implementation.

Thanks,
Brian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants