When making a call to:
It creates a BinaryFileRDD. Some sections of that code are run inside the driver container. The current source code for BinaryFileRDD is [available here|https://github.com/apache/spark/blob/2d085c13b7f715dbff23dd1f81af45ff903d1a79/core/src/main/scala/org/apache/spark/rdd/BinaryFileRDD.scala]:
The problematic line is:
This line sets the number of Threads to be used (in the case of multi-threading reading) to the number of cores (including Hyper Threading ones) available one the driver host machine.
This number is false, since what really matters is the number of cores allocated to the driver container by YARN and not the number of cores available in the host machine. This can easily impact the Spark-UI and the driver application performance, since the number of threads is far bigger than the true amount of allocated cores - which increases the number of unrequired preemptions and context switches
The solution is to retrieve the number of cores allocated to the Application Master by YARN instead.
Once confirmed the problem, I can work on retrieving that information and making a PR.