{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/16291","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/16291/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/16291/comments","events_url":"https://api.github.com/repos/apache/spark/issues/16291/events","html_url":"https://github.com/apache/spark/pull/16291","id":195704703,"number":16291,"title":"[SPARK-18838][CORE] Use separate executor service for each event listener","user":{"login":"sitalkedia","id":11507549,"avatar_url":"https://avatars.githubusercontent.com/u/11507549?v=3","gravatar_id":"","url":"https://api.github.com/users/sitalkedia","html_url":"https://github.com/sitalkedia","followers_url":"https://api.github.com/users/sitalkedia/followers","following_url":"https://api.github.com/users/sitalkedia/following{/other_user}","gists_url":"https://api.github.com/users/sitalkedia/gists{/gist_id}","starred_url":"https://api.github.com/users/sitalkedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sitalkedia/subscriptions","organizations_url":"https://api.github.com/users/sitalkedia/orgs","repos_url":"https://api.github.com/users/sitalkedia/repos","events_url":"https://api.github.com/users/sitalkedia/events{/privacy}","received_events_url":"https://api.github.com/users/sitalkedia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":27,"created_at":"2016-12-15T02:56:24Z","updated_at":"2016-12-28T01:46:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/16291","html_url":"https://github.com/apache/spark/pull/16291","diff_url":"https://github.com/apache/spark/pull/16291.diff","patch_url":"https://github.com/apache/spark/pull/16291.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nCurrently we are observing the issue of very high event processing delay in driver's `ListenerBus` for large jobs with many tasks. Many critical component of the scheduler like `ExecutorAllocationManager`, `HeartbeatReceiver` depend on the `ListenerBus` events and this delay might hurt the job performance significantly or even fail the job. For example, a significant delay in receiving the `SparkListenerTaskStart` might cause `ExecutorAllocationManager` manager to mistakenly remove an executor which is not idle.\r\nThe problem is that the event processor in `ListenerBus` is a single thread which loops through all the Listeners for each event and processes each event synchronously https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/scheduler/LiveListenerBus.scala#L94. This single threaded processor often becomes the bottleneck for large jobs. Also, if one of the Listener is very slow, all the listeners will pay the price of delay incurred by the slow listener. In addition to that a slow listener can cause events to be dropped from the event queue which might be fatal to the job.\r\nTo solve the above problems, we propose to get rid of the event queue and the single threaded event processor. Instead each listener will have its own dedicate single threaded executor service . When ever an event is posted, it will be submitted to executor service of all the listeners. The Single threaded executor service will guarantee in order processing of the events per listener. The queue used for the executor service will be bounded to guarantee we do not grow the memory indefinitely. The downside of this approach is separate event queue per listener will increase the driver memory footprint.\r\n\r\n## How was this patch tested?\r\n\r\nTested by running the job on the cluster and the average event processing latency dropped from 2 minutes to 3 milliseconds.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/269411329","html_url":"https://github.com/apache/spark/pull/16291#issuecomment-269411329","issue_url":"https://api.github.com/repos/apache/spark/issues/16291","id":269411329,"user":{"login":"sitalkedia","id":11507549,"avatar_url":"https://avatars.githubusercontent.com/u/11507549?v=3","gravatar_id":"","url":"https://api.github.com/users/sitalkedia","html_url":"https://github.com/sitalkedia","followers_url":"https://api.github.com/users/sitalkedia/followers","following_url":"https://api.github.com/users/sitalkedia/following{/other_user}","gists_url":"https://api.github.com/users/sitalkedia/gists{/gist_id}","starred_url":"https://api.github.com/users/sitalkedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sitalkedia/subscriptions","organizations_url":"https://api.github.com/users/sitalkedia/orgs","repos_url":"https://api.github.com/users/sitalkedia/repos","events_url":"https://api.github.com/users/sitalkedia/events{/privacy}","received_events_url":"https://api.github.com/users/sitalkedia/received_events","type":"User","site_admin":false},"created_at":"2016-12-28T01:46:04Z","updated_at":"2016-12-28T01:46:04Z","body":"jenkins test this please."}}
{"actor":{"display_login":"sitalkedia"}}