GitHub user vanzin opened a pull request: https://github.com/apache/spark/pull/19211
[SPARK-18838][core] Add separate listener queues to LiveListenerBus. This change modifies the live listener bus so that all listeners are added to queues; each queue has its own thread to dispatch events, making it possible to separate slow listeners from other more performance-sensitive ones. The public API has not changed - all listeners added with the existing "addListener" method, which after this change mostly means all user-defined listeners, end up in a default queue. Internally, there's an API allowing listeners to be added to specific queues, and that API is used to separate the internal Spark listeners into 3 categories: application status listeners (e.g. UI), executor management (e.g. dynamic allocation), and the event log. The queueing logic, while abstracted away in a separate class, is kept as much as possible hidden away from consumers. Aside from choosing their queue, there's no code change needed to take advantage of queues. Metrics were also simplified a little bit; the live bus now keeps track of metrics per queue instead of individual listeners. This is mostly to make integration with the existing metrics code in `ListenerBus` easier, without having to refactor the code; that can be done later if queue-level metrics are not enough. Test coverage relies on existing tests; a few tests had to be tweaked because they relied on `LiveListenerBus.postToAll` being synchronous, and the change makes that method asynchronous. Other tests were simplified not to use the asynchronous LiveListenerBus. You can merge this pull request into a Git repository by running: $ git pull https://github.com/vanzin/spark SPARK-18838 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/19211.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #19211 ---- commit 4a6858f57124a8b405e8ce414f61088a68dc27eb Author: Marcelo Vanzin <van...@cloudera.com> Date: 2017-09-06T00:07:01Z [SPARK-18838][core] Add separate listener queues to LiveListenerBus. This change modifies the live listener bus so that all listeners are added to queues; each queue has its own thread to dispatch events, making it possible to separate slow listeners from other more performance-sensitive ones. The public API has not changed - all listeners added with the existing "addListener" method, which after this change mostly means all user-defined listeners, end up in a default queue. Internally, there's an API allowing listeners to be added to specific queues, and that API is used to separate the internal Spark listeners into 3 categories: application status listeners (e.g. UI), executor management (e.g. dynamic allocation), and the event log. The queueing logic, while abstracted away in a separate class, is kept as much as possible hidden away from consumers. Aside from choosing their queue, there's no code change needed to take advantage of queues. Metrics were also simplified a little bit; the live bus now keeps track of metrics per queue instead of individual listeners. This is mostly to make integration with the existing metrics code in `ListenerBus` easier, without having to refactor the code; that can be done later if queue-level metrics are not enough. Test coverage relies on existing tests; a few tests had to be tweaked because they relied on `LiveListenerBus.postToAll` being synchronous, and the change makes that method asynchronous. Other tests were simplified not to use the asynchronous LiveListenerBus. ---- --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org