flap152's avatar
Level 11

Pipelining Redis commands on Vapor causes errors

I get errors attempting to use Redis::multi(Redis::PIPELINE) commands in Vapor. I am pre-populating Redis with geodata so a lot of little Redis::geoAdd commands. They don't need to be atomic or even in sequence.

The error is

    "message": "Error processing EXEC across the cluster",
    "context": {
        "exception": {
            "class": "RedisClusterException",
            "message": "Error processing EXEC across the cluster",
            "code": 0,
            "file": "/var/task/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php:116"
        },

Vapor uses phpredis as is recommended for the future. I see multi is a problem with phpredis as per: https://github.com/phpredis/phpredis/issues/876

Execution is 2.5 times faster in a local environment using pipeline. On vapor, my command times out (60 seconds) without multi.

Is there a Vapor or Laravel configuration to talk to redis to not be "across clusters" and avoid the error? A different client, just for these calls?

0 likes
2 replies
flap152's avatar
Level 11

I found choosing a 2048 memory (and relative CPU) instead of 1024 made my command run in 18 seconds instead of about 65. So I can make it work (not fail) but my questions stand.

flap152's avatar
Level 11

More research made me find the problem is intrinsic with use of cluster-redis, not the client. So I asked Vapor support: Is there a Vapor or Laravel configuration to talk to redis to not be "across clusters" and avoid the error? A different client, just for these calls?

From Vapor Support email:

I'm afraid we only support clustered redis on Vapor. You can however create a redis instance anywhere and reference it in your app by updating the environment variables like you'd do normally.

Please or to participate in this conversation.