akka.net icon indicating copy to clipboard operation
akka.net copied to clipboard

[WIP] Akka.IO / Akka.Streams: `ByteString` rewrite

Open Aaronontheweb opened this issue 1 year ago • 5 comments

Changes

A leftover milestone from v1.5 - we are dragging ByteString kicking and screaming into the .NET Core era with major refactoring, namely replacing all of its internals ReadOnlyMemory<byte> usage.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Latest dev Benchmarks

Include data from the relevant benchmark prior to this change here.

This PR's Benchmarks

Include data from after this change here.

Aaronontheweb avatar Mar 28 '24 21:03 Aaronontheweb

Tests are not currently compiling - working on that.

Aaronontheweb avatar Mar 28 '24 21:03 Aaronontheweb

Let's see how accurately ChatGPT was able to describe the current FSM behavior of Akka.IO's TcpConnection actor, one of the areas I'm looking to refactor:

stateDiagram-v2
    [*] --> WaitingForRegistration: Connection established
    WaitingForRegistration --> Connected: Register
    WaitingForRegistration --> Closing: CloseCommand
    WaitingForRegistration --> WaitingForRegistration: ResumeReading / SuspendReading
    Connected --> ClosingWithPendingWrite: CloseCommand with pending write
    Connected --> PeerSentEOF: PeerClosed (keep open)
    Connected --> Closing: CloseCommand
    Connected --> Connected: WriteCommand / SocketSent / SuspendReading / ResumeReading
    PeerSentEOF --> Closing: CloseCommand
    ClosingWithPendingWrite --> Closing: Write completed
    Closing --> Closed: Connection closed
    Closed --> [*]

Aaronontheweb avatar Apr 01 '24 20:04 Aaronontheweb

Honestly, not a bad job ChatGPT ^

Aaronontheweb avatar Apr 01 '24 20:04 Aaronontheweb

Looks like SocketAsyncEventArgs is still the way to go for high performance sockets in .NET: https://twitter.com/_MihaZupan/status/1774911865019113974

Aaronontheweb avatar Apr 02 '24 12:04 Aaronontheweb

Gonna need to redo this - stuff like the framing code is phenomenally messy and difficult to reason about. That needs to be refactored and simplified first.

Aaronontheweb avatar Apr 02 '24 20:04 Aaronontheweb