Note that there are some explanatory texts on larger screens.

plurals
  1. PORedis hash very slow writing speed
    primarykey
    data
    text
    <p>I'm facing a very strange issue : i get really crappy writing speeds when using redis (in a ideal world the writing speed should be approaching the writing speed on RAM).</p> <p>Here is my benchmark :</p> <pre><code>package redisbenchmark; import redis.clients.jedis.Jedis; public class RedisBenchmark { private static final String REDIS_KEY = "anon_id"; private Jedis conn; private long writeTimeNano=0; private RandomString stringGenerator; private String[] fields; public RedisBenchmark(){ conn = new Jedis("localhost"); stringGenerator = new RandomString(32); } public void run(int nbWrites, int nbReads){ writeBenchmark(nbWrites); } public void writeBenchmark(int amount){ fields = new String[amount]; for(int i=0; i&lt; amount; i++){ fields[i] = stringGenerator.nextString(); } long start = System.nanoTime(); for(int i=0; i&lt; amount; i++){ write(fields[i]); } writeTimeNano+=System.nanoTime()-start; double seconds = (double)writeTimeNano / 1000000000.0; System.out.println("[write]nb:"+amount+"|time:"+seconds+"|speed:"+((amount*33)/(seconds*1024*1024))+" MB/s"); } public void write(String anonId){ conn.hsetnx(REDIS_KEY, anonId, "1"); } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here RedisBenchmark benchmark = new RedisBenchmark(); benchmark.run(100000, 200); } } </code></pre> <p><code>RandomString</code> is a class that generates a random string (the arg is the string length)</p> <p>And below are a couple of results :</p> <blockquote> <p>[write]nb:100000|time:4.408319378|speed:0.713905907055318 MB/s [write]nb:100000|time:4.447246995|speed:0.707656949946542 MB/s</p> </blockquote> <p>I tried to modify the save to hdd parameters in the config file but with no improvement.</p> <p>I have 2 ideas:<br> 1. Its a socket problem since client and server (redis) are on the same machine<br> 2. The connector implementation has performance issues </p> <p><strong>UPDATE</strong> The benchmark results for set operation:</p> <blockquote> <p>====== SET ======<br> 10000 requests completed in 0.09 seconds<br> 50 parallel clients<br> 3 bytes payload<br> keep alive: 1</p> <p>99.51% &lt;= 1 milliseconds<br> 100.00% &lt;= 1 milliseconds<br> 111111.11 requests per second</p> </blockquote> <p>System specification :<br> - Ubuntu 11.04<br> - 8GB RAM<br> - Intel i5 processor</p> <p>Any suggestion will be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload