Deploy and scale a Blender 3D rendering farm in the cloud


20/02/2013 - Laurent Eschenauer (@eschnou)

We continue our cloud orchestration serie (#1, #2) with a new example showcasing the power of ComodIT to orchestrate the deployment and scaling of cloud applications.

Today we look at Blender 3D, a popular open-source 3D design and rendering studio. Rendering of animated films is a topic that suits really well distributed computing, since you can easily render individual frames using different machines, thus giving you a near-linear speed-up when adding nodes in your render farm.

In the followign example, we deploy a simple Blender 3D render farm in the cloud. These scripts have been tested on Amazon EC2 and Rackspace. You should be able to use them on private cloud such as Openstack, Cloudstack and Eucalyptus.

These orchestration scripts are available in the ComodIT repository. These scripts target a CentOS 6 distributions.

These scripts are simplified for educational purposes and deploy a very simple render-farm. If you have more complex orchestration use cases to discuss, we'd be happy to help out. Contact us and let's discuss about it.

Requirements

  1. A ComodIT account (you can register for free here).

  2. A ComodIT platform.

    If you havn't done it yet, add your cloud platform to ComodIT. In the ‘Platform’ section, click the Add button, pick a driver and fill in the specific details. For more information, you can follow one of these tutorials.

    Note that you won’t be able to deploy this example on the ‘Demo Platform’ provided by default, which is limited to maximum one provisioning at a time per user.

  3. A ComodIT distribution.

    The application templates used in this orchestration scripts have been written for Centos 6. You should therefore deploy on a compatible distribution. If you deploy on EC2, the easier is to get the ‘CentOS 6.3 (AMI)’ image from the ComodIT marketplace.

  4. The ComodIT Python library (bundled with command-line interface, see this tutorial for information about how to install it).

Deployment

  1. Clone the demos public repository and go inside the render-farm folder:

     git clone git@github.com:comodit/demos.git
     cd demos/render-farm
    
  2. Create a config.py file with the following content:

     endpoint = "https://my.comodit.com/api"
    
     username = "<user>"
     password = "<password>"
     organization = "<org_name>"
    
     time_out = 60 * 30  # seconds
    
     platform = {"name" : "Amazon EC2",
         "settings" : {
                  "ec2.instanceType": "m1.large",
                  "ec2.securityGroups": "renderfarm",
                  "ec2.zone": "eu-west-1a",
                  "ec2.keyPair": "mykeypair"
                  }
     }
    
     distribution = {"name" : "CentOS 6.3 (AMI)", "settings" : {}}
    

    where <user> and <password> are your ComodIT credentials, <org_name> the name of your organization. You should replace/update the ‘Amazon EC2’ platform with the one you intend to use, and update/replace the distribution if you arn’t using the CentOS 6.3 distribution provided by ComodIT.

    Warning: The applications you will deploy in next step are only compatible with CentOS 6! Therefore choose your ComodIT distribution accordingly. A distribution from the store like ‘CentOS 6.3 (AMI)'can be used.

  3. Setup ComodIT by executing setup.py. This will create an environment for the render farm as well as the applications needed to deploy it.

      ./setup.py
    
  4. Deploy the initial render farm by executing deploy.py. You can use the argument --count= to specify the number of render slaves to deploy.

      ./deploy.py --count=10
    
  5. If at a later stage you want to deploy more slaves, just use the scale.py command.

     ./scale.py --count=5
    
  6. When you don’t need your cluster, you can also downscale it using downscale.py.

     ./downscale --count=15
    
  7. If you want to teardown the complete render farm, just execute teardown.py

     ./teardown.py
    
  8. Finally, you can clean up all applications and environments created by these scripts.

     ./cleanup.py
    

Rendering a scene on the render farm

This render farm has a very simple deployment architecture. We deploy a master file server exposing its storage over NFS. The render slaves are mounting the remote date store and come with blender pre-installed.

The first thing you want to do is go on the master and prepare your scene files.

ssh master.example.com -l ec2-user
cd /data
wget http://download.blender.org/demo/test/test249.zip
unzip test249.zip

From that point, you can launch a rendering on each render slave. In order to distribute the load evenly, just use the -j command line argument. For example, if you have three render servers, you could do:

blender -b animation/bowl.blend -F JPEG -o output/bowl_# -s 1 -e 600 -j 3 -t 0 -a

And on the second server:

blender -b animation/bowl.blend -F JPEG -o output/bowl_# -s 2 -e 600 -j 3 -t 0 -a

Etc. This command will render frame by frame, and store the in the output folder. The -s flag specifies the first frame and -j the increment when jumping to the next frame.

blog comments powered by Disqus