Skip to content

Latest commit

 

History

History

parallel-deployment

Parallel deployment

Parallel deployment is a feature that allows to speed-up the deployment proces by processing multiple MTA modules in parallel. The feature is applicable for standard and blue-green deployment scenarios.

Parallel deployment feature relates to SAP Business Technology Platform entities that are represented by MTA modules - applications and application contents.

The feature does not relate to entities represented by MTA resources, for instance Cloud Foundry services. By default Cloud Foundry servicecs are processed in parallel without the need of any additional configuration.

Official Documentation

Activation

To activate the feature:

  • Use _schema-version with major version 3, for instance 3.1.0 or 3.3.0

  • Set the global parameter enable-parallel-deployments to true

...
_schema-version: 3.3.0
ID: hello-world
version: 1.0.0
parameters:
  enable-parallel-deployments: true
...
Note
Setting up the value of enable-parallel-deployments can be done in the mta.yaml, mtad.yaml or via an additional extension descriptor (*.mtaext) passed during deployment

Deployment order

When parallel deployment is activated, all modules are deployed simultaneously. There are cases when a module is dependent on another - for example the module initializing the database should be deployed before the others consuming that same database.

The module element deployed-after should be used to declare that dependency and influence the order of behavior:

...
modules:
...
- name: hello-world
...

- name: hello-world-third
  deployed-after:
      - hello-world
...

Try it out

In the current directory you’ll find an example cf app payload modeled to be deployed in parallel in both:

The example MTA contains 4 modules: hello-world, hello-world-first, hello-world-second and hello-world-third. 3 of them do not have any dependency order and will be processed in parallel accordingly. Only hello-world-third depends on hello-world, so it will be processed after the deployment of hello-world is completed.

Deploy directly from directory

In the current directory of the repository, run the command cf deploy. It will use the existing mtad.yaml file to automatically assemble an MTA archive and deploy it.

$ cf deploy
Deploying multi-target app archive ~/mta-examples/hello-world.mtar in org ****** / space ****** as ******...
...
Updating application "hello-world-second"...
Updating application "hello-world"...
Uploading application "hello-world-second"...
...

Assemble an MTA archive via mta.yaml and deploy

First run the command mbt assemble to create the MTAR archive from development descriptor mta.yaml:

$ mbt assemble
  INFO assembling the MTA project...
  INFO copying the MTA content...
  INFO generating the metadata...
  INFO generating the MTA archive...
  INFO the MTA archive generated at: /mta_examples/parallel-deployment/mta_archives/hello-world_1.0.0.mtar
  INFO cleaning temporary files...

Then deploy the assembled MTAR archive:

$ cf deploy mta_archives/hello-world_1.0.0.mtar
  Deploying multi-target app archive mta_archives/hello-world_1.0.0.mtar in org ****** / space ****** as ******...
  Uploading 1 files...

Build an MTA archive via mta.yaml and deploy

First run the command mbt build to create the MTAR archive:

$ mbt build
  INFO generating the "Makefile_20191029153016.mta" file...
  INFO done
  INFO executing the "make -f Makefile_20191029153016.mta p=cf mtar= strict=true mode=" command...
  INFO validating the MTA project
  INFO validating the MTA project
  INFO building the "hello-world" module...
  INFO the build results of the "hello-world" module will be packed and saved in the "/mta_examples/parallel-deployment/.parallel-deployment_mta_build_tmp/hello-world" folder
  INFO building the "hello-world-first" module...
  INFO the build results of the "hello-world-first" module will be packed and saved in the "/mta_examples/parallel-deployment/.parallel-deployment_mta_build_tmp/hello-world-first" folder
  INFO building the "hello-world-second" module...
  INFO the build results of the "hello-world-second" module will be packed and saved in the "/mta_examples/parallel-deployment/.parallel-deployment_mta_build_tmp/hello-world-second" folder
  INFO building the "hello-world-third" module...
  INFO the build results of the "hello-world-third" module will be packed and saved in the "mta_examples/parallel-deployment/.parallel-deployment_mta_build_tmp/hello-world-third" folder
  INFO generating the metadata...
  INFO generating the MTA archive...
  INFO the MTA archive generated at: /mta_examples/parallel-deployment/mta_archives/hello-world_1.0.0.mtar
  INFO cleaning temporary files...

Then deploy the built MTAR archive:

$ cf deploy mta_archives/hello-world_1.0.0.mtar
  Deploying multi-target app archive mta_archives/hello-world_1.0.0.mtar in org ***** / space ****** as ******...
  Uploading 1 files...
  ...

Enable/disable parallel deployments with extension descriptors using created MTAR file

$ cf deploy mta_archives/hello-world_1.0.0.mtar -e hello-world-parallel.mtaext
$ cf deploy mta_archives/hello-world_1.0.0.mtar -e hello-world-no-parallel.mtaext

Note the processing of the MTA in the command output of both commands.

Clean up resources

It is recommended to stop or undeploy your MTAs when they are no longer needed. In order to do so, run the following command:

$ cf undeploy <mta-id> -f --delete-services