Node.js vs ColdFusion Performance
11/06/2011 11:14:02 PM
The Showdown
Ok this isn't really a showdown. Both Nodejs and ColdFusion have their strong points and I didn't spend the time to go through them all. My question was simple, how much traffic can I ram down their throats and how quick will they respond. I incorporated a SQL insert into a local MySQL database. Now I will say, I had to use cluster to make it fair. Coldfusion will be using multiple threads along with Apache. Node running a single thread just isn't fair so I added one (1) worker per CPU for Nodejs. Also, I did verify that CF was able to process 10 simaltaineous requests. I left the default CF settings in-tact and of course, debugging was not turned on. **Note - I am using express to handle routes. My initial setup was using a good amount of configuration options which turned out to be very slow.
Results - Winner Nodejs

Here is the code I used
Coldfusion - index.cfm
<cfquery name="inserttets" datasource="mycooldatasource">
INSERT INTO inserttest (created)
VALUES (#now()#);
</cfquery>
DONE!
Nodejs - server.js
var express = require('express');
var app = express.createServer();
var cluster = require('cluster');
var datetime = require('datetime');
var mysql = require('mysql');
var client = mysql.createClient({
user: 'memyselfandi',
password: 'youdontcareaboutthis',
database: 'whatareyoulookingat'
});
app.get('/', function(req, res){
var d = datetime.format(new Date(), "%Y-%m-%d %T");
client.query("INSERT INTO inserttest SET created= ?", [d], function(err) {
if (err) {
res.writeHead(500, {'Content-Type': 'text/plain'});
res.end('DUDE SUX!');
throw err;
}
res.send("DONE!");
});
});
cluster(app)
.set('workers', 8)
.listen(8080);
Performance Summary of Maurer.me running Node.js
In Summary, here is my test and a list of JS files I created.
Test
Scripts
Reference
- HTTP Request Sampler - http://jakarta.apache.org/jmeter/usermanual/component_reference.html
- Sampler Result Class Reference - http://jakarta.apache.org/jmeter/api/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.html
- Complete JMeter Reference - http://jakarta.apache.org/jmeter/api/
- Regex Tester - http://jakarta.apache.org/oro/demo.html
