连接到数据库的风暴螺栓

问题描述 投票:0回答:1

我有一个喷嘴,它从每秒40K qps的源中读取数据。我有两个螺栓,第一个螺栓从源中读取数据并进行数据库连接以建立一个每小时刷新一次的缓存。数据库为用户打开了2个连接,因此我为此螺栓拥有的执行者计数为2。

为其他螺栓分配了200个执行者和200个任务来处理请求。

我无法增加与数据库的连接。而且我看到所有请求都将交给单身工人。其他工作人员继续等待并打印“ 0发送消息”。

kafkaSpoutConfigList:
  - executorsCount: 30
    taskCount: 30
    spoutName: 'kafka_consumer_spout'
    topicName: 'request'

processingBoltConfigList:
  - executorsCount: 2
    taskCount: 2
    boltName: 'db_bolt'
    boltClassName: 'com.Bolt1Class'
    boltSourceList:
      - 'kafka_consumer_spout'
  - executorsCount: 200
    taskCount: 200
    boltName: 'bolt2'
    boltClassName: 'com.Bolt2Class'
    boltSourceList:
      - 'db_bolt::streamx'

kafkaBoltConfigList:
  - executorsCount: 15
    taskCount: 15
    boltName: 'kafka_producer_bolt'
    topicName: 'consumer_topic'
    boltSourceList:
      - 'bolt2::Stream1'
  - executorsCount: 15
    taskCount: 15
    boltName: 'kafka_producer_bolt'
    topicName: 'data_test'
    boltSourceList:
      - 'bolt2::Stream2'

我正在使用localandgroupshuffling。

apache-storm
1个回答
1
投票

当您使用LocalOrShuffleGrouping时,会发生以下情况:

如果目标螺栓在同一工作进程中具有一个或多个任务,则元组将改组为那些正在进行的任务。否则,这就像普通的随机分组一样。

因此,假设您的工人看起来像这样:

worker1: {"bolt1 task 1", "bolt2 task 0-50"}
worker2: { "bolt1 task 2", "bolt2 task 50-100"}
worker3: { "bolt2 task 100-150"}
worker4: { "bolt2 task 150-200"}

在这种情况下,因为您告诉Storm在从bolt1发送到bolt2时使用本地分组,所以所有的元组都将传递给工作程序1和2。工作程序3和4将处于空闲状态。

如果您还希望将元组也发送给工作者3和4,则需要切换为随机分组。

© www.soinside.com 2019 - 2024. All rights reserved.