Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Latency while reusing redis client #36

Open
IdanFridman opened this issue Feb 16, 2016 · 0 comments
Open

Latency while reusing redis client #36

IdanFridman opened this issue Feb 16, 2016 · 0 comments

Comments

@IdanFridman
Copy link

I am using the same RedicClient(as recommended) for couple of connections types. and I am having huge latency issues while using them in parallel:

using biz.paluch.redis:lettuce:4.0.Beta2

    private RedisClient client;
    private StatefulRedisConnection<String, String> connection;
    private RedisCommands syncCommands;
    private RedisGeoAsyncCommands<String, String> geoAsyncCommand;
    private RedisAsyncCommands<String, String> asyncCommands;
    private RedisCommands<String, String> redisSyncConnection;
  @PostConstruct
    public void init() {
        log.debug("RedisRepo, Init.");
        client = new RedisClient(REDIS_HOST, REDIS_PORT);
        connection = client.connect();
        connection.setTimeout(10, TimeUnit.SECONDS);
        syncCommands = connection.sync();
        syncCommands.setTimeout(4, TimeUnit.SECONDS);
        geoAsyncCommand = client.connect().async();
        //  RedisClusterClient clusterClient = new RedisClusterClient(new RedisURI(REDIS_HOST,REDIS_PORT,60, TimeUnit.SECONDS));
        asyncCommands = client.connect().async();
        redisSyncConnection = client.connect().sync();
    }

and I have separate methods being invoked with diff Redis commands in parallel

Latency report:
]$ /opt/redis-unstable/src/redis-cli --intrinsic-latency 100
Max latency so far: 1 microseconds.
Max latency so far: 32 microseconds.
Max latency so far: 8147 microseconds.
Max latency so far: 8217 microseconds.
Max latency so far: 12169 microseconds.
Max latency so far: 12182 microseconds.
Max latency so far: 12199 microseconds.
Max latency so far: 12223 microseconds.
Max latency so far: 12255 microseconds.
Max latency so far: 12298 microseconds.
Max latency so far: 12303 microseconds.
Max latency so far: 12310 microseconds.
Max latency so far: 12330 microseconds.

253109899 total runs (avg latency: 0.3951 microseconds / 3950.85 nanoseconds per run).
Worst run took 31208x longer than the average latency.

  1. Am I using the Redis Client properly?
  2. Is it the right way to use multiple connection types with the same RedisClient?

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant