Question: I'm currently looking into how best to use the parallel step in a Jenkins Workflow script and am just looking to clarify my understanding of how this works.

```
parallel(firstTask: {
    node {
       // Do some stuff
    }
}, secondTask: {
    node {
        // Do some other stuff
    }
})

```

In this case would each task, because its contained within a node utilize an executor each? If I didn't have the node blocks would the task still run concurrently?

Presumably the most performant solution is to run each node on a separate slave?

I'm currently using a set-up with a single master box with two executors (although since its a quad core machine I'm thinking I could increase this) and I'm just trying to judge the best way to utilize the parallel step or indeed whether in this set-up it isn't worth worrying about.

Answer: 
> 
> If I didn't have the node blocks would the task still run concurrently?
> 
> 
> 

Yes, this:

```
parallel(firstTask: {
   // Do some stuff
}, secondTask: {
   // Do some other stuff
})

```

will run non-sequential.

For instance with the **Build Flow** plugin:

```
   build("job 1")

   parallel
   (
      {build("job 2")}
      {build("job 3")}
   )

   build("job 4")

```

If you have 2 executors, then you can run 2 jobs in parallel.
When you want to run more jobs in parallel, you would need to increase the executor number (via node configuration).
For a small number of jobs this might work out, but you can quickly introduce a mess of chained job definitions.

Thats why you could also look at the **Multijob** plugin.

It allows to define "Phases". The Phases are executed sequentially.
But each "Phase" can execute many jobs in parallel.
This allows the following workflow: "process parallel jobs of Phase 1 (until all finished), then proceed to Phase 2".

* Issue <https://issues.jenkins-ci.org/browse/JENKINS-12480>
* Plugin <https://wiki.jenkins-ci.org/display/JENKINS/Multijob+Plugin>
* Github <https://github.com/jenkinsci/tikal-multijob-plugin>

> 
> Presumably the most performant solution is to run each node on a separate slave?
> 
> 
> 

This is not easily answered. It depends on the project. 

A performance oriented Jenkins setup is often used, when the developers want to get the build artefacts quickly. 

I would try working with one box and introduce the next slave, when hitting a defined maximum workload with the goal to reduce the total build time. In other words: you could keep an eye on CPU utilization and measure/compare build times, while experimenting with different Jenkins setups, its probably A/B testing.
Try this, 
[link](http://devops-jenkins.blogspot.in)

You can also run parallel jobs with passing parameters.

example:

```
   parallel
   (
    {build("job 1", param1:"value1",param2:"value2")}
    {build("job 2",param1:"value1")}
   )

```