|
@@ -1,8 +1,10 @@
|
|
|
var cluster = require('cluster')
|
|
|
, numCPUs = require('os').cpus().length;
|
|
|
|
|
|
-numCPUs = 1
|
|
|
-if (cluster.isMaster) {
|
|
|
+var host = "172.16.234.132"
|
|
|
+ host = "127.0.0.1";
|
|
|
+
|
|
|
+if(cluster.isMaster) {
|
|
|
// Fork workers.
|
|
|
for (var i = 0; i < numCPUs; i++) {
|
|
|
cluster.fork();
|
|
@@ -19,12 +21,11 @@ var http = require('http')
|
|
|
, url = require('url')
|
|
|
, async = require('async')
|
|
|
, mongoose = require('mongoose')
|
|
|
- // , conn = mongoose.connect('mongodb://172.16.234.132/hello_world')
|
|
|
- , conn = mongoose.connect('mongodb://localhost/hello_world')
|
|
|
+ , conn = mongoose.connect('mongodb://' + host + '/hello_world')
|
|
|
, MongoClient = require('mongodb').MongoClient
|
|
|
- , mysql = require('mysql')
|
|
|
+ // , mysql = require('mysql')
|
|
|
// , pool = mysql.createPool({
|
|
|
- // host: '172.16.234.132',
|
|
|
+ // host: host,
|
|
|
// user : 'benchmarkdbuser',
|
|
|
// password : 'benchmarkdbpass',
|
|
|
// database : 'hello_world',
|
|
@@ -32,7 +33,7 @@ var http = require('http')
|
|
|
// })
|
|
|
// , Sequelize = require("sequelize")
|
|
|
// , sequelize = new Sequelize('hello_world', 'benchmarkdbuser', 'benchmarkdbpass', {
|
|
|
- // host: '172.16.234.132',
|
|
|
+ // host: host,
|
|
|
// logging: false,
|
|
|
// define: { timestamps: false },
|
|
|
// maxConcurrentQueries: 100,
|
|
@@ -46,7 +47,7 @@ var http = require('http')
|
|
|
|
|
|
var collection = null;
|
|
|
|
|
|
-MongoClient.connect('mongodb://localhost:27017/hello_world?maxPoolSize=5', function(err, db) {
|
|
|
+MongoClient.connect('mongodb://' + host + '/hello_world?maxPoolSize=5', function(err, db) {
|
|
|
collection = db.collection('world');
|
|
|
});
|
|
|
|