Yes. Well in my test, I set 4 workers which spawned 8 executors. So for the bolt with parallelismHit as 3, there were enough executors assigned to the tasks, resulting in 1 executor/thread for 1 task. What have been confusing me is how a task works. I thought, when a task of ,say a bolt, starts running, it creates a instance of the bolt, calls prepare() method to do some initializing thing; then execute() is called when a tuple comes; till the task finishs, cleanup() method of the bolt is called. Is that right?
Hao Yu From: Pandian R Date: 2015-01-29 20:14 To: user Subject: Re: About parallelism of a bolt As far as I know, setting parallelism for a spout/bolt doesn't increase the number of threads in which it is executed. If you need to increase the number of threads, you need to set the num_workers to be the number you need. On Thu, Jan 29, 2015 at 4:17 PM, 余昊 <[email protected]> wrote: Hi, I set the parallelism of a bolt to 3 with the java code: builder.setBolt("myBolt", myBolt, 3); I think, 3 myBolt instances would be created in 3 tasks each of which would run in a different thread (i.e. executor) in parallel. To prove that, I printed out the bolt instance name in the prepare() method of MyBolt class, expecting 3 different instance names in the worker log files. However, things did not always go like that. I tested twice, the second topology worked as I expected. But in the first topology, 6701,6702,6703 ports were assigned to "myBolt", and I found the exactly same bolt instance name in worker-6701.log and worker-6702.log files, which were different from worker-6703.log file. So how to explain this? Hao Yu -- Regards, Pandian
