为什么commandhandler和redistatemachine被多次调用,可以改进吗?

eimct9ow  于 2021-06-09  发布在  Redis
关注(0)|答案(0)|浏览(363)

环境
嗨,我有一个redis集群,比如:spring.redis.cluster.nodes=10.105.179.236:9001,10.105.179.236:9002,10.106.157.104:9001,10.106.157.104:9002,10.106.146.95:9001,10.106.146.95:9002
数据库:
我的sprintbootapi将获得两个db数据并存储到redis中。
问题
https://github.com/lettuce-io/lettuce-core/issues/1279
当我调用api来获取redis数据时,我发现莴苣多次调用commandhandler和redistatemachine函数。
我的意思是我想知道为什么多次调用commandhandler和redistatemachine。如果可以的话,我认为减少“commandhandler和redistatemachine”函数的调用次数可以提高莴苣的性能。
日志

[http-nio-5252-exec-1] [DEBUG] [i.l.core.RedisChannelHandler] dispatching command AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command]
[http-nio-5252-exec-1] [DEBUG] [i.l.c.c.PooledClusterConnectionProvider] getConnection(READ, 11489)
[http-nio-5252-exec-1] [DEBUG] [i.l.c.protocol.DefaultEndpoint] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, epid=0x8] write() writeAndFlush command ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[http-nio-5252-exec-1] [DEBUG] [i.l.c.protocol.DefaultEndpoint] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, epid=0x8] write() done
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] write(ctx, ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], promise)
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandEncoder] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001] writing command ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 9 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 1460 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 4096 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 3204 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 1460 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: false
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Received: 2238 bytes, 1 commands in the stack
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.core.protocol.CommandHandler] [channel=0xb31d8ed8, /10.34.136.113:64651 -> /10.106.146.95:9001, chid=0x8] Stack contains: 1 commands
....
....
....
....
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decode ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5]
[lettuce-nioEventLoop-4-8] [DEBUG] [i.l.c.protocol.RedisStateMachine] Decoded ClusterCommand [command=AsyncCommand [type=GET, output=ValueOutput [output=[B@10072a6f, error='null'], commandType=io.lettuce.core.protocol.Command], redirections=0, maxRedirections=5], empty stack: true

为什么commandhandler和redistatemachine被多次调用?
我想可能是为了打不同的位置,但是可以改进吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题