Programing/Akka

Akka Distributed Publish Subscribe in Cluster #3. Configuration

BUST 2018. 9. 11. 21:37

Akka Distributed Publish Subscribe in Cluster #3. Configuration

Akka PubSub에 대한 Configuration에 대해 알아보자.

application.conf

# Settings for the DistributedPubSub extension

akka.cluster.pub-sub {

  # Actor name of the mediator actor, /system/distributedPubSubMediator

  name = distributedPubSubMediator


  # Start the mediator on members tagged with this role.

  # All members are used if undefined or empty.

  role = ""


  # The routing logic to use for 'Send'

  # Possible values: random, round-robin, broadcast

  routing-logic = random


  # How often the DistributedPubSubMediator should send out gossip information

  gossip-interval = 1s


  # Removed entries are pruned after this duration

  removed-time-to-live = 120s


  # Maximum number of elements to transfer in one message when synchronizing the registries.

  # Next chunk will be transferred in next round of gossip.

  max-delta-elements = 3000


  # When a message is published to a topic with no subscribers send it to the dead letters.

  send-to-dead-letters-when-no-subscribers = on

  

  # The id of the dispatcher to use for DistributedPubSubMediator actors. 

  # If not specified default dispatcher is used.

  # If specified you need to define the settings of the actual dispatcher.

  use-dispatcher = ""

}


Routing 로직으로 인해 불균등 분배

  • routing-logic 의 기본값이 `random`이기 때문에 특정 서버에만 데이터가 몰리는 현상이 있을수가 있다
  • `round-robin`을 이용하여 데이터를 분배를 하면 해결이 된다.

gossip-interval 

  • gossip 통신 주기

max-delta-elements

  • gossip 통신을 할때 등록된 actor (registries)가 동기화 될때 최대로 보낼수 있는 메시지 크기에 대한 설정