AWS Lambda vs IronWorker
Overview
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.
Table of Contents
- Example - A Lambda Function vs a Worker in IronWorker
- Invoking Lambda Functions vs Queuing IronWorker Tasks
- Comparison Chart
- Conclusion
Achieve Cloud Elasticity with Iron
Speak to us to find how you can achieve cloud elasticity with a serverless messaging queue and background task solution with free handheld support.
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:
- Install Node.js if you don’t have it already
- Create a project directory called 'lambda-vs-ironworker'
- You must have an AWS account and an Iron.io account setup
- Install the AWS cli tool and the IronWorker cli tool
Lambda Hello World
- 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 }
- 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 *
- Create an IAM role for Lambda
- 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
- Create a test input file called 'helloworld-input.txt' with:
{ "key1":"value1", "key2":"value2", "key3":"value3" }
- Invoke the function:
aws lambda invoke-async --function-name helloworld --region us-east-1 --invoke-args helloworld-input.txt --debug
- Check the AWS console to ensure it ran and see the output.
IronWorker Hello World
Now let's try the same thing on IronWorker.
- IronWorker will use almost the exact same 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!");
- Create a file 'helloworld.worker' and paste this into it:
runtime "node" exec "helloworld-iron.js"
- Upload the worker:
iron_worker upload helloworld
- Invoke/run the worker:
iron_worker queue --payload-file helloworld-input.txt
- 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.
- For Lambda, your application would call the InvokeAsync endpoint.
- For IronWorker, you'd call the Queue a Task endpoint. Note that you can also schedule tasks in IronWorker, execute them via webhooks and from IronMQ push queues.
Iron.io Serverless Tools
Speak to us to learn how IronWorker and IronMQ are essential products for your application to become cloud elastic.
Comparison Chart
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 |
|
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!
Unlock the Cloud with Iron.io
Find out how IronWorker and IronMQ can help your application obtain the cloud with fanatical customer support, reliable performance, and competitive pricing.
Great article and agree iron had a more complete product. One thing I couldn’t figure out after reading this post was exactly how to trigger a task from s3 upload. You mention in your comparison its supported but I can only seem to find s3 events that go to 3 aws destinations. Not external webhook. Am I missing something?