Storm運維調優筆記(7)——Pyleus設置拓撲worker數量

jopen 8年前發布 | 21K 次閱讀 運維技術 分布式/云計算/大數據

今天簡單介紹一下Pyleus設置worker數量,同時介紹設置之后worker與實際編程spout、bolt的關系。

Pyleus官網 (https://yelp.github.io/pyleus)有這樣一段介紹:

Topology level optionsname(str)[mandatory]

Name assigned to your topology.

topology(seq)[mandatory]

Sequence containing all components of the topology, where each component is a map. Allowed components: spout, bolt.

workers(int)

Number of workers to be spawned.

ackers(int)

Number of executors for ackers to be spawned. Corresponds to Storm TOPOLOGY_ACKER_EXECUTORS.

max_spout_pending(int)

Maximum number of tuples that can be pending on a spout task at any given time.

加粗部分是對如何設置拓撲工作節點數量的設置,即workers參數。

而這里如何在yaml配置文件中設置是個問題,因為官網沒有給出該參數設置的示例。一般,yaml文件如下這樣設置:

從上面引用官網的信息中可以知道,workers參數是Topology的參數,而上圖中name、topology都是拓撲的參數,所以他們應該是并列。應該做如下設置:

這樣設置后使用打包命令將代碼編譯打包并提交:

pyleus --verbose build  -n master word_count/pyleus_topology.yaml
pyleus --verbose submit -n master word_count.jar

會看到如下的運行界面:

可以看到不管是整個集群,還是word_count拓撲都顯示6個slot全部使用,雖然只有1個spout、3個bolt,使用4個worker即可,這里還是將這些slot分配給了word_count。

這里要對worker設置個數與實際使用情況講解一下:

(1)拓撲實際代碼中需要使用conf設置workers的數量

(2)設置workers數量之后,只是劃定使用slot的資源池,該資源池只給這個拓撲用。可以通過storm rebalance 命令任意調整,均衡worker之前的處理請求數量

(3)一般設置的workers數量>spout+bolt的數量,否則拓撲將等待執行

(4)因拓撲中workers數量可以在程序端設置,所以使用時要慎重,不能隨便設置或者過大設置,不然影響整個集群的運行

來自: http://www.adintellig.com/storm-operation-tuning-07/

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!