I have an application where node.js which listen and populates rabbitmq 
with messages, this performs well without https. The load is around 500,000 
messages to be processed per hour.
Using https the same application crawls and cpu is around 100% usage.




Here is the server script.

---
var express = require('express');
var app = express();
var fs = require('fs');
var https = require('https');
var http = require('http');
app.use(express.bodyParser());
var utils = require('connect').utils

var amqp = require('amqp');
var connection = amqp.createConnection({url: 
"amqp://guest:guest@localhost:5672"},{defaultExchangeName: ''});
connection.on('ready', function() {
  console.log('connected');
});

app.get('/', function(req, res){
 fs.readFile('/server/index.html', 'utf8', function(err, text){
        res.send(text);
    });
});

app.get('/robots.txt', function(req, res){
 fs.readFile('/server/robots.txt', 'utf8', function(err, text){
        res.send(text);
    });
});


var options = {
  key: fs.readFileSync('../cert.key'),
  cert: fs.readFileSync('../cert.crt'),
};

app.post('/process', function(req, res) {

  var messageToSend =utils.merge(req.headers,req.body);
  
  var n = messageToSend['id'];

  //// decide even and odd queue on last char of id
  if(parseInt(n.charAt(n.length -4)) % 2 == 1){
        var queueToSendTo = "odd";
  }else{
        var queueToSendTo = "even";
  }

  connection.publish(queueToSendTo, messageToSend);
  res.send(200);
});


app.setMaxListeners(0);
var httpServer = http.createServer(app);
var httpsServer = https.createServer(options, app);
httpServer.listen(80);
httpsServer.listen(443);

The server is a VM on a  dual CPU hardware with 8 GB of RAM.

Only processes running are of rabbitmq and node.js.

I am new to node.js please help in identifying ways to improve performance 
of SSL.

Many Thanks
- Sachin.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to