Skip to content

Instantly share code, notes, and snippets.

@ramonsnir
Created February 21, 2016 13:13
Show Gist options
  • Save ramonsnir/bb7158931db43cb7185e to your computer and use it in GitHub Desktop.
Save ramonsnir/bb7158931db43cb7185e to your computer and use it in GitHub Desktop.

Revisions

  1. ramonsnir created this gist Feb 21, 2016.
    4 changes: 4 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    FROM node:4.3.1
    ADD . .
    RUN npm install
    CMD node test.js
    7 changes: 7 additions & 0 deletions HOWTO.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Checkout `2.x` branch.
    Download the three other files to the root directory of the repo.

    `docker-compose build`
    `docker-compose run`

    See if it can reach 150_000_000 in about a minute.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    test:
    build: .
    links:
    - redis
    redis:
    image: grokzen/redis-cluster
    29 changes: 29 additions & 0 deletions test.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    var Redis = require('./index');

    var redis = new Redis.Cluster([
    {
    port: 7001,
    host: 'redis',
    },
    {
    port: 7002,
    host: 'redis',
    },
    {
    port: 7003,
    host: 'redis',
    },
    ]);

    var i = 0;

    function send() {
    console.log(process.memoryUsage());
    for (var j = 0; j < 1000; j++) {
    redis.set('quay', i++);
    }
    }

    setInterval(function() {
    send();
    }, 500);