AWS Lambda vs IronWorker

If imitation is the sincerest form of flattery, then consider us flattered by Amazon. The new AWS Lambda service is nearly the same thing as Iron.io’s IronWorker service, solving the same problem with a slightly different API.

I took it on as a project recently to compare and contrast how each service works, how they are similar, and how they differ.

This post is the results of that comparison.

Example – A Lamda Function vs a Worker in IronWorker

We’ll start using the first example from the AWS Lambda documentation, Walkthrough 1:  Handling User Application Events

Here are a few things we need to do first to get things set up for the test:

  1. Install Node.js if you don’t have it already
  2. Create a project directory called ‘lambda-vs-ironworker’
  3. You must have an AWS account and an Iron.io account setup
  4. Install the AWS cli tool and the IronWorker cli tool

Lambda Hello World

These are the steps to create your Lambda function, upload it, and run it. A fast track version of the walkthrough in the AWS docs.
  1. Create a file called ‘helloworld.js’ and paste this code into it:
    console.log('Loading event');
    exports.handler = function(event, context) {
      console.log("value1 = " + event.key1);
      console.log("value2 = " + event.key2);
      console.log("value3 = " + event.key3);
      context.done(null, "Hello World");  // SUCCESS with message
    }
    
  2. Zip up the files in the folder (just the helloworld.js for this example). From the cli, this would look like:
    zip -r helloworld.zip *
    
  3. Create an IAM role for Lambda
  4. Upload the Lambda function:
    aws lambda upload-function 
       --region us-east-1 
       --function-name helloworld 
       --function-zip helloworld.zip 
       --role arn:aws:iam::356671443308:role/executionrole 
       --mode event 
       --handler helloworld.handler 
       --runtime nodejs 
       --profile adminuser
       --debug
    
  5. Create a test input file called ‘helloworld-input.txt’ with:
    {
       "key1":"value1",
       "key2":"value2",
       "key3":"value3"
    }
    
  6. Invoke the function:
    aws lambda  invoke-async 
     --function-name helloworld 
     --region us-east-1 
     --invoke-args helloworld-input.txt 
     --debug
    
  7. Check the AWS console to ensure it ran and see the output.

IronWorker Hello World

Now let’s try the same thing on IronWorker.

  1. IronWorker will use almost the exact some code, but removing some Lambda specific stuff. Create a file called ‘helloworld-iron.js’ and paste this code into it:
    console.log('Loading event');
    var worker = require('node_helper'); // IronWorker helper that loads the input for you
    var event = worker.params;
    console.log("value1 = " + event.key1);
    console.log("value2 = " + event.key2);
    console.log("value3 = " + event.key3);
    console.log("Hello World!");
    
  2. Create a file ‘helloworld.worker’ and paste this into it:
    runtime "node"
    exec "helloworld-iron.js"
    
  3. Upload the worker:
    iron_worker upload helloworld
    
  4. Invoke/run the worker:
    iron_worker queue --payload-file helloworld-input.txt
    
  5. Check HUD (Iron.io’s console) to ensure it ran and see the output. The queue command will return a link on the command line that will take you directly to the task too.

Results

You should see the same output on both systems and as you can see, the operations and code are very similar. All the code used in this example can be found here as well as code for Walkthrough #2.

Invoking Lambda Functions vs Queuing IronWorker Tasks

Invoking/queuing these functions/workers from your code instead of the cli like we’ve done here, is also very similar.

Comparison Chart

This is a comparison of a bunch of the main features of the products.
Lambda IronWorker
Event-Based Triggers
Yes 
(from an AWS-supported event only)
Yes 
(from an AWS-supported event as well as events from any services that supports webhooks)
Timeout
max 60 seconds
max 1 hour
(long-running workers available)
Startup Time
Sub-second
Few seconds
Language/runtime
Node.js only
All major languages – PHP, Python, Ruby, Node.js, Java, .Net, Go, Scala, binary executables.
Memory size
64 – 1024 MB, default 128MB
320 – 2048MB, default 320MB
Clouds
AWS
AWS, Rackspace, Microsoft Azure, private clouds, and more
Dedicated Clusters (Private)
No
Yes
On-Premise
No
Yes (see here)
Scheduling
No
Yes (see here)
Make simple functions via console
Yes 
(only useful when using aws-sdk node module only since that’s imported by default)
No

Conclusion

As you can see, Lambda is very similar to IronWorker, in fact it’s almost the same service with a different spin on it.

A few important things to note though is that IronWorker has been operating in production for over 4 years, runs on multiple clouds (including your own on-premise cloud), supports all major programming languages, has more features (see above), and did I mention our customer support rocks?

Lambda on the other hand is brand new, only supports Node.js, only runs on AWS, and their customer support leaves a lot to be desired (unless you pay up). Don’t get me wrong, Lambda is solving a big problem and is probably a great service, as are all the AWS services, we just think IronWorker is better. But you can come to your own conclusions on that after trying them out.

There are some areas we’ll be working on improving in IronWorker to address some of the noteworthy aspects of Lambda, most noticeably the process startup-time. Stay tuned!

 


Try IronWorker for Free

To try IronWorker for free, sign up for an account at Iron.io. On-demand processing awaits!