Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • parallelism-min =2 : 동시에 활성화되는 최소 스레드수 (available processors * factor)
  • parallelism-max = 8 : 동시에 활성화되는 최대 스레드수
  • parallelism-factor =2.0 : Core개수대비 최대가 될수있는 스레드수
  • throughput =100 : 동시에 처리하는 메시지수
  • fixed-pool-size =32 : 스레드 개수 고정

동시처리 스레드 제한 예제

panel
Code Block
languagejava
themeEmacs
//application.conf 설정

blocking-io-dispatcher {


 type = Dispatcher


 executor = "thread-pool-executor"


 thread-pool-executor {


 fixed-pool-size
= 32
}
throughput = 1
}
 = 2
 }
 throughput = 1
}


//구현부
//특정 액터 Dispatcher지정


ActorRef
myActor
 testActor =

 system.actorOf(
Props
ext.
create(MyActor.class)
props("testActor")
 .withDispatcher("blocking-io-dispatcher"),

"myactor3");

 "service1");


// 동시에 메시지 전송
for(int i=0;i<10;i++)
 testActor.tell("test message wiht dispatcher",null);
Expand

[INFO] [05/06/2018 23:27:21.795] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.798] [AkkaTestApp-blocking-io-dispatcher-9] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.799] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.800] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.801] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.801] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.802] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.807] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.807] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher
[INFO] [05/06/2018 23:27:21.807] [AkkaTestApp-blocking-io-dispatcher-8] [TestActor] Incommessage test message wiht dispatcher

동시처리수를 1개로 제한하고, 스레드수를

...

2개로 제한을하면

...

스레드모델중 세마포어와

...

유사한 스레드풀 기능을 수행하게 되며

일반적으로

...

심플하게 사용되는 방식입니다.

...

동시 요청이

...

10개가 왔다고하면,

...

스레드 두개만 활용하여 분배되어 처리되게 됩니다.