Spark running on Mesos shares resources with other frameworks running on Mesos. It is important to understand the trade-offs of resource sharing and tuning Spark on Mesos for realizing the maximum benefits without sacrificing the application requirements. While running Spark on the Mesos cluster, resource sharing happens in two modes:
Fine-grain: By default, Spark will run each task as a separate Mesos task. This means that cluster resources are shared with the other frameworks running alongside Spark (or other instances of Spark itself). In this fine-grained mode, Mesos can share cluster resources among all applications in an elastic manner, but this elasticity comes at the cost of a higher overhead when launching tasks. This overhead is not significant for most applications but can be noticeable for applications with stringent timing requirements.