Forum Discussion

DennesTorres's avatar
DennesTorres
Icon for Power Participant rankPower Participant
2 years ago
Solved

Parallel Execution

Hi,

This is multiple questions in one....

I know we have two methods of parallel executions, one is the mssparkutils.runmultiple and the other is the for/each in a pipeline.

Am I correct in assuming the mssparkutils.runmultiple uses the high concurrency mode, which needs to be enabled in the workspace, while the pipelines are not capable to do so yet?

Both of them can receive errors related to the capacity. I'm testing with a pipeline and 5 parallel executions already generates errors in my environment. How can we calculate how many parallel executions are possible to make in each of these two scenarios ?

Thank you in advance !

  • Hi DennesTorres,

     

    High concurrency mode in Spark allows you to share the Spark Compute to execute notebooks in an instant fashion instead of waiting to spin up new compute for each notebook. The runMultiple run uses the compute engine's multi-threading to run the different notebooks. In a way, both of them help achieve high concurrency using the same compute power.

     

    High concurrency mode that you enable while using Spark is more for interactive approach at this moment. So let's say you are parallely working in many notebooks and you want to share the same compute so that you can start instantly as well as save costs, high concurrency mode is the way to go. For doing the same in code, you are using runMultiple which uses the same approach. 

     

    It is true that pipelines don't do concurrent execution using the same session. But it is in the roadmap: https://learn.microsoft.com/en-us/fabric/release-plan/data-engineering#concurrency

     

    So for now, as you mentioned, we can use pipeline to run a notebook that uses runMultiple to run different notebooks to achieve concurrency.

     

  • DennesTorres's avatar
    DennesTorres
    2 years ago

    Hi,

    I got an explanation from the support about the never ending session. 

    According to them, the runmultiple DAG should never be used with more than 50 activities. Strange things could happen if we try, such as the session never ending.

    Kind Regards,

    Dennes

12 Replies

  • Hi DennesTorres,

     

    High concurrency mode in Spark allows you to share the Spark Compute to execute notebooks in an instant fashion instead of waiting to spin up new compute for each notebook. The runMultiple run uses the compute engine's multi-threading to run the different notebooks. In a way, both of them help achieve high concurrency using the same compute power.

     

    High concurrency mode that you enable while using Spark is more for interactive approach at this moment. So let's say you are parallely working in many notebooks and you want to share the same compute so that you can start instantly as well as save costs, high concurrency mode is the way to go. For doing the same in code, you are using runMultiple which uses the same approach. 

     

    It is true that pipelines don't do concurrent execution using the same session. But it is in the roadmap: https://learn.microsoft.com/en-us/fabric/release-plan/data-engineering#concurrency

     

    So for now, as you mentioned, we can use pipeline to run a notebook that uses runMultiple to run different notebooks to achieve concurrency.

     

    • DennesTorres's avatar
      DennesTorres
      Icon for Power Participant rankPower Participant

      Hi,

      Thank you. This matches with my findings as well, but I was a bit confuse because I found articles talking about adjusting the session DOP for the runmultiple, which didn't make sense. For the runmultiple, biggest is the pool, the better.

      On the other hand, on my tests with runmultiple, I had two problems: First, it only reaches the maximum resources made available close to the "end" of the script, and I don't understand why. I don't know what to look into the logs to find the reason and fix it.

      Second, it never ends. It continues to run continously for hours until I cancel the session. Am I missing some end statement? I'm using mssparkutil.notebook.exit .

      The image below illustrates the problems:



      Thank you in advance!

      Dennes

      • govindarajan_d's avatar
        govindarajan_d
        Icon for Super User rankSuper User

        Hi DennesTorres,

         

        By going to spark history server, we can look at the different types of logs. 

         

        And then going to each stage and see how each partition gets executed.

         

         

        Debugging a spark application for performance is going to be lot harder, but this might be a good place to start. 

         

        Do you use notebook.exit in all the notebooks?

         

  • MKassem's avatar
    MKassem
    Frequent Visitor

    Hey DennesTorres

    try to add timeout arg to the activity 

     

    {
                "name": "Notebook",
                "path": "Notebook",
                "retry": 3,
                "args": {'useRootDefaultLakehouse': True},
                "timeoutPerCellInSeconds": 1200
            }