Skip to content

Reactive Cluster MGET is not running in parallel #2395

@koisyu

Description

@koisyu

Bug Report

RedisAdvancedClusterReactiveCommandsImpl.mget is not running in parallel

Current Behavior

If you run the code below, it will take a long time.

RedisClusterClient client = RedisClusterClient.create("redis://localhost");
RedisAdvancedClusterReactiveCommands<String, String> reactiveCommands = client.connect().reactive();
List<String> keys = IntStream.rangeClosed(1, 100).boxed().map(index -> "key-" + index).collect(Collectors.toList());
reactiveCommands.mget(keys.toArray(new String[]{})).collectList().block();

If I run the above code and check the Tcpdump, I can see that the requests and responses are alternating in order, like this.
That is, they are executed sequentially.

image

Expected behavior/code

I expect MGET commands to be executed in parallel.

image

Environment

  • Lettuce version(s): 6.1.9.RELEASE
  • Redis version: 4.0.14

Possible Solution

If the Flux#concat code is replaced with Flux#mergeSequential, the MGET commands are executed in parallel.

  • Flux#concat
    image
  • Flux#mergeSequential
    image

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions