1

I have a scenario where application need to to get operation from redis around 80 times per request. When I am hitting 1 request on that application it gives response in less than 1 seconds but when increased the request size to 100 redissonClient starts behaving slowly and takes around 13 seconds to fetch 250 records.

I am new to redis and unsure if this is default. Though I found out in some article saying redis can handle millions of operation in 1 second on 1 node. Our redis server is running on 1 node currently.

Below is the redis configuration:

{
"singleServerConfig": {
    "idleConnectionTimeout": 10000,
    "pingTimeout": 1000,
    "connectTimeout": 10000,
    "timeout": 2000,
    "retryAttempts": 3,
    "retryInterval": 1500,
    "reconnectionTimeout": 2000,
    "failedAttempts": 3,
    "password": null,
    "subscriptionsPerConnection": 5,
    "clientName": null,
    "address": "redis://172.18.17.207:6379",
    "subscriptionConnectionMinimumIdleSize": 1,
    "subscriptionConnectionPoolSize": 50,
    "connectionMinimumIdleSize": 32,
    "connectionPoolSize": 100,
    "database": 0,
    "dnsMonitoringInterval": 5000
},
"threads": 128,
"nettyThreads": 128,
"codec": null,
"useLinuxNativeEpoll": false
}

And below is how I am instantiating redisson client at the time of startup:

try {
        Config config = Config.fromJSON(CommonConstants.REDIS_SINGLE_CONFIG_JSON_FILE);
        redisClient = Redisson.create(config);
    } catch (IOException e) {
        log.error(null, "Error establishing connection to Redis Cluster!", e);
    }

And below is how I am fetching records:

public List<Map<String, String>> fetch(List<String> ids) {
    return ids.stream().map(id -> {
        Map<String, String> m = redisClient.getMapCache(id);
        return m;
    }).collect(Collectors.toList());
}

I suspect I have wrongly configured redis client but could not figure out what is that.

Any help/light is much appreciated.

Thanks

ArunavaS
  • 197
  • 1
  • 12

1 Answers1

1

Stream uses iterator provided by RMapCache object. It fetches only 10 elements by default, I would recommend you to use RMapCache.readAllMap method instead.

Nikita Koksharov
  • 10,283
  • 1
  • 62
  • 71