You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »


단순하게 DB를 호출해서 그값을 가공하거나? 외부 API를 호출하여 가공하는 형태의 API가아닌

리모트,클러스터,샤딩,퍼시던트등 다양한 메시지모델및 분산처리를  적용하여

고급 API개발에 접근하는것이 목표입니다. AKKA는 단지 이용수단이며

AKKA학습을 통해 조금더 고급 네트워크에 기법을 사용하는 개발 스택을 넓히는데 목적이있습니다.


Akka로 할수 있는것들 

Rest Model과 연동되어, 고급(스케일 업다운/클러스터) API를 설계를한 케이스입니다.

AKKA는 클러스터/분산처리를 단순화할수 있는 툴킷이지만, 복잡한 문제를 풀어야 하는 툴킷이자

라이브러리이기때문에, 잘 사용하고/구현하는것은 결코 만만한것은 아닙니다. 

하지만 이러한 개발을 AKKA없이 기존 가진 개발 스택으로는 아주어려운것 임을 인지하는게 중요한듯합니다.


remote

link:http://www.aaronstannard.com/markedup-akkadotnet/

Akka를 이용한 개인진행 저장소 : https://github.com/psmon/psmonSearch/blob/master/README.md

Actor란 무엇인가?

쓰레드를 몇개 생성해서 최적화를 할까?

안전한 처리를위해 어떠한 모델을 쓸까? 고민을 덜수있습니다.

Thread VS Actor

remote

remote

장애처리 모델(Supervision)

try-catch는 메시지 전송및 구조적 모델에서 적합하지 않는 예외 처리모델입니다.

Akka에서는 여러가지 장애처리모델을 지원하고 있습니다.

One-For-One Strategy vs. All-For-One Strategy

image

image

link : http://getakka.net/articles/concepts/supervision.html

OOP VS Actor

Remote Test

remote

remote

Server Config

akka {	            
	remote {
		log-remote-lifecycle-events = DEBUG
		log-received-messages = on
          
		helios.tcp {
			port = 9000 #bound to a specific port
			hostname = 127.0.0.1
		}
}

Server Code Sample

public class MyActor : ReceiveActor
{        
    public MyActor()
    {
        Receive<string>(message => {                
            Console.WriteLine("Received String message: {0}", message);
            Sender.Tell("re:"+message);
        });

        Receive<List<int>>(message => {
            Console.WriteLine("Received ListCount: {0}", message.Count);
            Sender.Tell("re:" + message);
        });
    }
}

using (ActorSystem system = ActorSystem.Create("MyServer", config))
{
	system.ActorOf<MyActor>("greeter");
	Console.ReadKey();
}

Client Code Sample

var greeter = system.ActorSelection("akka.tcp://MyServer@localhost:9000/user/greeter");
var result = greeter.Ask("Hi2", null).Result; //Wair For Result
Console.WriteLine(result);

List<int> tmpList = new List<int>();
greeter.Tell(tmpList);    //Just Tell...

BroadCast Test

remote

Server Code Sample

var system = ActorSystem.Create("ServiceB")
system.ActorOf<TestActor>("b1");
system.ActorOf<TestActor>("b2");
system.ActorOf<TestActor>("b3");

Client Code Sample

provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
	deployment {
	/some-group {
		router = broadcast-group
		routees.paths = [
		"akka.tcp://ServiceB@127.0.0.1:8002/user/b1",
		"akka.tcp://ServiceB@127.0.0.1:8002/user/b2", 
		"akka.tcp://ServiceB@127.0.0.1:8002/user/b3"]
	}
                
}		
var props = Props.Create<TestActor>().WithRouter(FromConfig.Instance);
var broadCaseActor = system.ActorOf(props, "some-group");
broadCaseActor.Tell("HI");

RoundRobin Test

remote

Config Sample

akka.actor.deployment {
  /some-pool {
	router = round-robin-pool
	nr-of-instances = 5
  }
}

ConsistentHashRouter Test

remote

Message Sample

public class SomeMessage : IConsistentHashable
{
   public Guid GroupID { get; private set; }
   public object ConsistentHashKey {  get { return GroupID; } }
}

Config Sample

akka.actor.deployment {
  /some-pool {
	router = consistent-hashing-pool
	nr-of-instances = 5
	virtual-nodes-factor = 10
  }
}

ScatterGatherFirstCompleted Test

remote

Config Sample

akka.actor.deployment {
  /some-pool {
	router = scatter-gather-pool
	nr-of-instances = 5
	within = 10s
  }
}

SmallestMailBox Test

remote

Config Sample

akka.actor.deployment {
  /some-pool {
	router = smallest-mailbox-pool
	nr-of-instances = 5
  }
}

Persistence Test ( Memory DB,Local DB )

Persistence모듈은 메모리DB인 redis기능 자체를 모두포함하는 기능은아니며

Actor의 상태를 좀더 추상적(FSM디자인패턴)으로 관리하고 유지함으로, 서비스특화된 고성능 메모리DB를 구현하는데 의의가 있습니다.

link : http://getakka.net/articles/persistence/persistent-fsm.html

In-memory journal plugin.

akka.persistence.journal.inmem {

In-memory snapshot store plugin.

akka.persistence.snapshot-store.inmem {
	# Class name of the plugin.
	class = "Akka.Persistence.Snapshot.MemorySnapshotStore, Akka.Persistence"
	# Dispatcher for the plugin actor.
	plugin-dispatcher = "akka.actor.default-dispatcher"
}

Local file system snapshot store plugin.

akka.persistence.snapshot-store.local {    

cluster-sharding

remote

link : https://petabridge.com/blog/introduction-to-cluster-sharding-akkadotnet/

Java와 이기종통신

AKKA의 태생은 JAVA로부터 왔기때문에, .net에서 Actor기반 메시지 설계가 가능하다면

JAVA에서도 동일한 컨셉으로 구현이 가능합니다. 이기종간 Actor메시지 전송을 기대해보지만 아직 미지원으로 확인되었으며

이경우 웹소켓중간 인터페이스를 경유해 이기종 고성능 통신이 가능합니다.

플래폼 파편화에 따른 저수준의 순수한 고성능 이기종 통신이 필요하다면 JnBridge 도입 검토도 해볼 필요가 있습니다.

link : http://git.interparktour.com/N17042/AKKATEST/snippets/7

link2 : https://www.playframework.com/documentation/2.6.x/ScalaWebSockets

link3 : https://jnbridge.com/

Akka를 이용한 머신러닝으로 확장(텐서플로우 대체 플래폼은 아님)

AKKA는 텐서플로우 대체 플랫폼도 아니며 AI전용 플랫폼도아닙니다.

네트워크 라이브러리가, 어떻게 머신러닝으로 확장가능한지? 심화학습을 하는데 목적이 있습니다.

remote

link : http://getakka.net/articles/streams/workingwithgraphs.html (고성능 네트워크 데이터 전송및 연산 실현을 위해,AkkaStreams/Graphs로 확장이됩니다.)

link : http://www.cakesolutions.net/teamblogs/lifting-machine-learning-into-akka-streams


  • © 2017 GitHub, Inc.




이 문서 검색

인기있는 주제

특별 페이지

There is no content with the specified labels

최근에 변경된 페이지

  • No labels