From b38b3cf5abf6e4a6737685d834aa5e9abd5fb4fb Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Thu, 1 Jun 2017 16:34:42 -0700 Subject: [PATCH] Default to using Mongo for caching Stress testing shows that after the recent caching optimization there seems to be no significant difference in performance when using Mongo for caching as opposed to Redis. Redis is still supported but is now optional. Also removed hiredis dependency since as of node_redis 2.6 the default parser is faster than hiredis. --- README.md | 7 +++---- config/config-sample.json | 2 -- lib/config.coffee | 2 +- lib/cwmp.coffee | 2 +- package.json | 5 +++-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 95d95d1..e7d13d0 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,11 @@ systems ## Quick Start -Install [Node.js](http://nodejs.org/), [Redis](http://redis.io/), and -[MongoDB](http://www.mongodb.org/). Refer to the corresponding documentation for -installation guides. Supported versions are: +Install [Node.js](http://nodejs.org/) and [MongoDB](http://www.mongodb.org/). +Refer to their corresponding documentation for installation instructions. The +supported versions are: - Node.js: 6.x and 7.x (7.x recommended) -- Redis: 2.4 through 3.2 - MongoDB: 2.6 through 3.4 Then install GenieACS using NPM: diff --git a/config/config-sample.json b/config/config-sample.json index 1bdac84..9925c9f 100644 --- a/config/config-sample.json +++ b/config/config-sample.json @@ -1,7 +1,5 @@ { "MONGODB_CONNECTION_URL" : "mongodb://127.0.0.1/genieacs", - "REDIS_PORT" : "6379", - "REDIS_HOST" : "127.0.0.1", "CWMP_INTERFACE" : "0.0.0.0", "CWMP_PORT" : 7547, "CWMP_SSL" : false, diff --git a/lib/config.coffee b/lib/config.coffee index c2b3f60..1f57a73 100644 --- a/lib/config.coffee +++ b/lib/config.coffee @@ -24,7 +24,7 @@ options = { CONFIG_DIR : {type : 'path', default : 'config'}, MONGODB_CONNECTION_URL : {type : 'string', default : 'mongodb://127.0.0.1/genieacs'}, REDIS_PORT : {type : 'int', default : 6379}, - REDIS_HOST : {type : 'string', default : '127.0.0.1'}, + REDIS_HOST : {type : 'string', default : ''}, REDIS_DB : {type : 'int', default : 0}, CWMP_WORKER_PROCESSES : {type : 'int', default : 0}, diff --git a/lib/cwmp.coffee b/lib/cwmp.coffee index ab40241..2023bcb 100644 --- a/lib/cwmp.coffee +++ b/lib/cwmp.coffee @@ -601,7 +601,7 @@ getSession = (httpRequest, callback) -> currentSessions = new WeakMap() -# When socket closes, store active sessions in redis +# When socket closes, store active sessions in cache onConnection = (socket) -> currentSessions.set(socket, {}) socket.on('close', () -> diff --git a/package.json b/package.json index fe20b99..77037bc 100644 --- a/package.json +++ b/package.json @@ -19,13 +19,14 @@ "bin": "bin" }, "dependencies": { - "hiredis": "^0.5.0", "later": "^1.2.0", "libxmljs": "^0.18.4", "mongodb": "^2.2.24", - "redis": "^2.6.5", "seedrandom": "^2.4.2" }, + "optionalDependencies": { + "redis": "^2.6.5" + }, "devDependencies": { "coffeescript": "^1.12.4" },