programing

C # 용 액터의 좋은 구현이 있습니까?

nasanasas 2020. 10. 29. 08:12
반응형

C # 용 액터의 좋은 구현이 있습니까?


.net / c #에 대한 액터 동시성 모델 의 좋은 구현이 있습니까?

저는 AC # 루틴을 최적화해야하고 배우 모델이 제 문제에 대한 해결책으로 완벽하게 적합하다고 생각합니다. 불행히도 저는 스칼라 구현에 대한 경험이 있습니다.


MS CCR (Concurrency & Coordination Runtime)Robotic Studio의 일부인 DSS (Decentralized Software Services )를 살펴 봐야 합니다.

이러한 프레임 워크를 사용하면 대부분의 행위자 접근 요구 사항을 충족하는 느슨하게 결합 된 서비스를 개발할 수 있습니다.

Axum이 가장 적합 할 것입니다. 안타깝게도 여전히 일종의 알파 / 베타 단계에 있습니다 (2011 년 2 월에 종료되었습니다). 나는 그것을 내 연구에 사용하고 일반적인 방향이 위대하고 엄청난 잠재력을 가지고 있다고 말해야합니다.

C #은 아니지만 C ++는 필요한 모든 기능을 제공하는 Microsoft의 비동기 에이전트 라이브러리 입니다.

.NET 4의 병렬 관련 기능잘 살펴보십시오 .

도움이 되었기를 바랍니다.


.NET Actor Model 프레임 워크 :

프로토 배우

  • 배우
  • 가상 배우

https://github.com/AsynkronIT/protoactor-dotnet

Akka.NET

  • 배우

https://github.com/akkadotnet/akka.net

Microsoft Orleans

  • 가상 배우

https://github.com/dotnet/orleans


배우에 대한 Project Orleans Microsoft의 접근 방식을 살펴볼 수도 있습니다 (지난주에 출시됨).

다음은 프로젝트 웹 사이트입니다. http://research.microsoft.com/en-us/projects/orleans/

다음은 빌드 2014의 소개로 좋은 이야기입니다.

Orleans를 사용하여 Azure에서 Halo 4의 분산 클라우드 서비스 구축 http://channel9.msdn.com/Events/Build/2014/3-641

오늘 게시 된 다운로드 비트는 CTP입니다.

Orleans 소개 : http://felixnotes.com/orleans-microsofts-take-on-the-actor-pattern-in-net/

그리고 예, 또한 오픈 소스였습니다 : https://github.com/dotnet/orleans


Stact

.Net의 actor-lib. 꽤 유능하고 잘 테스트되었습니다. TopShelf, MassTransit 및 NServiceBus.Host의 기초입니다.

https://github.com/phatboyg/stact

추상화를 포함합니다.

  • 워크 플로우 : 복잡한 상태 기반 프로토콜을 정의하고 실행할 수 있습니다.
  • 개체 간 메시지 전달을 지원하는 채널
  • 유형 및 익명의 액터
  • 협력적인 스레딩 모델 인 Fibers
  • 라우팅
  • 요청 / 답장
  • 스케줄러

예정 :

  • 적절한 감독자 계층

Chris가 글을 쓰는 시점에 적극적으로 개발되었습니다.

개요 :

동시 애플리케이션을 개발하려면 현재 소프트웨어 개발 방법에서 벗어나 자율 시스템 구성 요소 간의 동시성과 통신을 강조하는 접근 방식이 필요합니다. 액터 모델은 메시지를 교환하여 (객체 지향 설계의 인터페이스에서 메서드를 호출하는 대신) 서로 상호 작용하는 액터라는 소프트웨어 구성 요소 시스템을 정의하고, 제어 대신 데이터가 구성 요소를 통해 흐르는 시스템을 생성하여 충족시킵니다. 시스템의 기능적 요구 사항.

Stact는 .NET에서 액터 모델을 사용하여 애플리케이션을 빌드하기위한 라이브러리입니다. 주 어셈블리 인 Stact.dll은 액터 라이브러리이며 모든 유형의 애플리케이션에서 액터 모델을 사용하는 데 필요한 모든 것을 포함합니다. 소켓이나 HTTP를 통해 액터를 노출하는 데 사용할 수있는 Stact.ServerFramework와 같은 추가 지원 프레임 워크도있어 액터를 사용하여 서비스를 빌드 할 수 있습니다.


NAct 는 정말 사용하기 쉬운 접근 방식을 취하는 .NET 용 액터 프레임 워크입니다. (면책 조항 : 내가 썼습니다)

두 액터간에 전달되는 메시지는 두 개체 간의 메서드 호출 일뿐입니다. 모든 메서드 인수가 변경 불가능하고 스레드로부터 안전한지 확인해야합니다.

스레드 전환을 처리하는 프록시에서 개체를 래핑하여 작동합니다. 모든 일반 .NET 기능, 특히 이벤트가 올바르게 처리되므로 일반 코드를 작성할 수 있으며 스레드 마샬링이 자체적으로 발생합니다.

C # 5 async / await를 지원하는 분기도 있습니다.


오늘 Microsoft는이 그림에 따라 행위자 프로그래밍 모델을 구현하는 Azure Service Fabric을 발표했습니다.

Azure Service Fabric

공지 사항보기 : http://azure.microsoft.com/blog/2015/04/20/announcing-azure-service-fabric-reducing-complexity-in-a-hyper-scale-world/

업데이트 : 이제 SDK 를 사용할 수 있으며 비디오 자습서 도 있습니다.


I don't know of any implementations for C#, but there's a whole new programming language based on the Actor model by Microsoft. It's called Axum:

Axum (previously codenamed Maestro) is a domain specific concurrent programming language, based on the Actor model, being developed by Microsoft. It is an object-oriented language based on the .NET Common Language Runtime using a C-like syntax which, being a domain-specific language, is intended for development of portions of a software application that is well-suited to concurrency. But it contains enough general-purpose constructs that one need not switch to a general-purpose programming language (like C#) for the sequential parts of the concurrent components.


Have you considered MailboxProcessor of T, provided with F#?


You should also consider PostSharp Actors


Remact.Net is my current project. It uses WebSockets and Json for the remote actor messaging. It has typesafety for C# actors but also supports dynamic types for browser based actors written in Java script.

My previous project was AsyncWcfLib. This is a C# library for actors communicating in a process or between different applications. The remote message passing uses WCF.
An actor catalog service enables actor discovery on several hosts.The hosts may run Windows or Linux.


FSharp.Actor

An actor framework for F#.

From an example:

let rec schizoPing =
    (fun (actor:IActor<_>) ->
        let log = (actor :?> Actor.T<_>).Log
        let rec ping() =
            async {
                let! (msg,_) = actor.Receive()
                log.Info(sprintf "(%A): %A ping" actor msg, None)
                return! pong()
            }
        and pong() =
            async {
                let! (msg,_) = actor.Receive()
                log.Info(sprintf "(%A): %A pong" actor msg, None)
                return! ping()
            }
        ping()
    )

Sending two messages to the 'schizo' actor results in

let schizo = Actor.spawn (Actor.Options.Create("schizo")) schizoPing

!!"schizo" <-- "Hello"
!!"schizo" <-- "Hello"

Output:

(schizo): "Hello" ping
(schizo): "Hello" pong

Find it at github and at docs


Just noticed this question, and thought to add a newer data point. Microsoft currently has a semi-official project for this, called ActorFX. It's open source and still evolving, but worth keeping an eye on...


As already mentioned, F#'s MailboxProcessor class offers a simple, straightforward implementation of the actor model. A fantastic introduction on how to use it is available here. F# interoperates with C# very well and you can wrap up the agent in a class with methods which post different messages. For the cases where the agent will reply with an asynchronous response, see the PostAndAsyncReply method. This returns an Async workflow which you can turn into a task that can be awaited in C# using the Async.StartAsTask method.

Finally, if you need to distribute your actors remotely, I recommend you check out Akka.NET which offers both C# and F# APIs.

참고URL : https://stackoverflow.com/questions/2186222/any-good-implementation-of-actors-for-c

반응형