seata 1.3 redis模式重构性能对比
!!!非官方数据,此压测数据为server端redis模式重构过程中,中间过程的测试数据。!!!
测试目的:
测试server端redis模式下,全局锁及事务信息存储,使用string和hash两种数据结构的性能差异。以对部分代码重构提供参考依据。
声明:
本测试数据,受限测试机,服务器,中间件配置,以及场景,仅仅代表个人测试数据,不代表实际生产部署的性能。测试使用的部分代码来自于未被合并的代码!!!不具有稳定版本的性能参考意义。请复制黏贴党不要断章取义!
声明:
本测试数据,受限测试机,服务器,中间件配置,以及场景,仅仅代表个人测试数据,不代表实际生产部署的性能。测试使用的部分代码来自于未被合并的代码!!!不具有稳定版本的性能参考意义。请复制黏贴党不要断章取义!
场景为:
order - > storage -> account
每次请求修改数据为
order insert 1条 - > storage 修改5条 -> account 修改1条。
注意:storage表中只有5条数据,account表中1条数据。此测试场景,并发请求的数据完全相同,会造成严重的全局锁冲突,重试。
工具:jmeter
测试项目:springcloud-eureka-feign-mybatis-seata
版本:seata版本为1.3 redis存储模式,单独合并了此bugfix pr,超时时间60s,配置默认。
部署:seata 1.3 windows10本地启动
redis 阿里云 1核1G docker启动
mysql 阿里云 1核1G docker启动
结果:数据采用95%Line 3次平均值:
1.业务链路正常测试数据
5并发
lock hash,session hash
lock hash,session string
lock string,session string
mysql
50并发
lock hash,session hash
lock hash,session string
lock string,session string
mysql
100并发
lock hash,session hash
lock hash,session string
lock string,session string
mysql
压测异常
redis模式下,压测过程主要异常如下:
io.seata.core.exception.BranchTransactionException: Global lock acquire failed xid = 100.64.20.95:8091:52520571292217344 branchId = 52520852440608769
22:19:07.035 INFO --- [ TxTimeoutCheck_1_1] i.s.s.coordinator.DefaultCoordinator : Global transaction[100.64.20.95:8091:52520574958039040] is timeout and will be rollback.
22:19:07.049 ERROR --- [verHandlerThread_1_31_500] i.s.c.e.AbstractExceptionHandler : Catch TransactionException while do RPC, request: xid=100.64.20.95:8091:52520571292217344,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
==>
io.seata.core.exception.BranchTransactionException: Global lock acquire failed xid = 100.64.20.95:8091:52520571292217344 branchId = 52520852440608769
at io.seata.server.transaction.at.ATCore.branchSessionLock(ATCore.java:48)
at io.seata.server.coordinator.AbstractCore.lambda$branchRegister$10(AbstractCore.java:77)
at io.seata.server.storage.redis.session.RedisSessionManager.lockAndExecute(RedisSessionManager.java:194)
at io.seata.server.session.SessionHolder.lockAndExecute(SessionHolder.java:275)
at io.seata.server.coordinator.AbstractCore.branchRegister(AbstractCore.java:72)
at io.seata.server.coordinator.DefaultCore.branchRegister(DefaultCore.java:97)
at io.seata.server.coordinator.DefaultCoordinator.doBranchRegister(DefaultCoordinator.java:192)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:184)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:179)
at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:116)
at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:179)
at io.seata.core.protocol.transaction.BranchRegisterRequest.handle(BranchRegisterRequest.java:136)
at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:427)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.onRequestMessage(ServerOnRequestProcessor.java:116)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.process(ServerOnRequestProcessor.java:77)
at io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
<==
22:19:07.105 INFO --- [ TxTimeoutCheck_1_1] i.s.s.coordinator.DefaultCoordinator : Global transaction[100.64.20.95:8091:52520571720036352] is timeout and will be rollback.
22:19:07.106 INFO --- [verHandlerThread_1_30_500] io.seata.server.coordinator.DefaultCore : Rollback global transaction successfully, xid = 100.64.20.95:8091:52520571195748352.
io.seata.core.exception.GlobalTransactionException: Could not register branch into global session xid = 100.64.20.95:8091:52520571598401536 status = TimeoutRollbacking while expecting Begin
22:19:09.724 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=100.64.20.95:8091:52520571598401536,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
,clientIp:100.64.20.95,vgroup:default
22:19:09.753 INFO --- [ TxTimeoutCheck_1_1] i.s.s.coordinator.DefaultCoordinator : Global transaction[100.64.20.95:8091:52520571967500288] is timeout and will be rollback.
22:19:09.773 ERROR --- [verHandlerThread_1_46_500] i.s.c.e.AbstractExceptionHandler : Catch TransactionException while do RPC, request: xid=100.64.20.95:8091:52520571598401536,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
==>
io.seata.core.exception.GlobalTransactionException: Could not register branch into global session xid = 100.64.20.95:8091:52520571598401536 status = TimeoutRollbacking while expecting Begin
at io.seata.server.coordinator.AbstractCore.globalSessionStatusCheck(AbstractCore.java:102)
at io.seata.server.coordinator.AbstractCore.lambda$branchRegister$10(AbstractCore.java:73)
at io.seata.server.storage.redis.session.RedisSessionManager.lockAndExecute(RedisSessionManager.java:194)
at io.seata.server.session.SessionHolder.lockAndExecute(SessionHolder.java:275)
at io.seata.server.coordinator.AbstractCore.branchRegister(AbstractCore.java:72)
at io.seata.server.coordinator.DefaultCore.branchRegister(DefaultCore.java:97)
at io.seata.server.coordinator.DefaultCoordinator.doBranchRegister(DefaultCoordinator.java:192)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:184)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:179)
at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:116)
at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:179)
at io.seata.core.protocol.transaction.BranchRegisterRequest.handle(BranchRegisterRequest.java:136)
at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:427)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.onRequestMessage(ServerOnRequestProcessor.java:116)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.process(ServerOnRequestProcessor.java:77)
at io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
<==
22:19:09.833 INFO --- [ TxTimeoutCheck_1_1] i.s.s.coordinator.DefaultCoordinator : Global transaction[100.64.20.95:8091:52520572613423104] is timeout and will be rollback.
22:19:09.888 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=100.64.20.95:8091:52520571329966080,extraData=null
,clientIp:100.64.20.95,vgroup:default
io.seata.core.exception.GlobalTransactionException: Could not found global transaction xid = 100.64.20.95:8091:52520574215647232, may be has finished.
22:19:30.670 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=100.64.20.95:8091:52520574131761152,extraData=null
,clientIp:100.64.20.95,vgroup:default
22:19:30.747 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=100.64.20.95:8091:52520574215647232,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
,clientIp:100.64.20.95,vgroup:default
22:19:30.787 ERROR --- [rverHandlerThread_1_9_500] i.s.c.e.AbstractExceptionHandler : Catch TransactionException while do RPC, request: xid=100.64.20.95:8091:52520574215647232,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
==>
io.seata.core.exception.GlobalTransactionException: Could not found global transaction xid = 100.64.20.95:8091:52520574215647232, may be has finished.
at io.seata.server.coordinator.AbstractCore.assertGlobalSessionNotNull(AbstractCore.java:120)
at io.seata.server.coordinator.AbstractCore.branchRegister(AbstractCore.java:71)
at io.seata.server.coordinator.DefaultCore.branchRegister(DefaultCore.java:97)
at io.seata.server.coordinator.DefaultCoordinator.doBranchRegister(DefaultCoordinator.java:192)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:184)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:179)
at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:116)
at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:179)
at io.seata.core.protocol.transaction.BranchRegisterRequest.handle(BranchRegisterRequest.java:136)
at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:427)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.onRequestMessage(ServerOnRequestProcessor.java:116)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.process(ServerOnRequestProcessor.java:77)
at io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
<==
22:19:30.936 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=100.64.20.95:8091:52520574173704192,extraData=null
,clientIp:100.64.20.95,vgroup:default
db模式mysql,下,压测过程主要异常如下:
10:55:12.122 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=192.168.158.80:8091:52710864220127232,extraData=null
,clientIp:192.168.158.80,vgroup:default
10:55:12.124 ERROR --- [verHandlerThread_1_14_500] i.s.c.e.AbstractExceptionHandler : Catch TransactionException while do RPC, request: xid=192.168.158.80:8091:52710864304013312,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
==>
io.seata.core.exception.GlobalTransactionException: Could not register branch into global session xid = 192.168.158.80:8091:52710864304013312 status = TimeoutRollbacking while expecting Begin
at io.seata.server.coordinator.AbstractCore.globalSessionStatusCheck(AbstractCore.java:102)
at io.seata.server.coordinator.AbstractCore.lambda$branchRegister$10(AbstractCore.java:73)
at io.seata.server.storage.db.session.DataBaseSessionManager.lockAndExecute(DataBaseSessionManager.java:197)
at io.seata.server.session.SessionHolder.lockAndExecute(SessionHolder.java:275)
at io.seata.server.coordinator.AbstractCore.branchRegister(AbstractCore.java:72)
at io.seata.server.coordinator.DefaultCore.branchRegister(DefaultCore.java:97)
at io.seata.server.coordinator.DefaultCoordinator.doBranchRegister(DefaultCoordinator.java:192)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:184)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:179)
at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:116)
at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:179)
at io.seata.core.protocol.transaction.BranchRegisterRequest.handle(BranchRegisterRequest.java:136)
at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:427)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.onRequestMessage(ServerOnRequestProcessor.java:116)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.process(ServerOnRequestProcessor.java:77)
at io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
<==
10:55:12.134 INFO --- [ RetryRollbacking_1_1] io.seata.server.coordinator.DefaultCore : Rollback global transaction successfully, xid = 192.168.158.80:8091:52710862731149312.
10:55:12.158 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=192.168.158.80:8091:52710864270458880,extraData=null
,clientIp:192.168.158.80,vgroup:default
10:55:07.945 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=192.168.158.80:8091:52710861707739136,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
,clientIp:192.168.158.80,vgroup:default
10:55:07.966 INFO --- [verHandlerThread_1_39_500] i.s.s.s.db.lock.LockStoreDataBaseDAO : Global lock on [storage:1] is holding by xid 192.168.158.80:8091:52710861548355584 branchId 52711108743856129
10:55:07.980 ERROR --- [verHandlerThread_1_39_500] i.s.c.e.AbstractExceptionHandler : Catch TransactionException while do RPC, request: xid=192.168.158.80:8091:52710861707739136,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
==>
io.seata.core.exception.BranchTransactionException: Global lock acquire failed xid = 192.168.158.80:8091:52710861707739136 branchId = 52711110014730241
at io.seata.server.transaction.at.ATCore.branchSessionLock(ATCore.java:48)
at io.seata.server.coordinator.AbstractCore.lambda$branchRegister$10(AbstractCore.java:77)
at io.seata.server.storage.db.session.DataBaseSessionManager.lockAndExecute(DataBaseSessionManager.java:197)
at io.seata.server.session.SessionHolder.lockAndExecute(SessionHolder.java:275)
at io.seata.server.coordinator.AbstractCore.branchRegister(AbstractCore.java:72)
at io.seata.server.coordinator.DefaultCore.branchRegister(DefaultCore.java:97)
at io.seata.server.coordinator.DefaultCoordinator.doBranchRegister(DefaultCoordinator.java:192)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:184)
at io.seata.server.AbstractTCInboundHandler$4.execute(AbstractTCInboundHandler.java:179)
at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:116)
at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:179)
at io.seata.core.protocol.transaction.BranchRegisterRequest.handle(BranchRegisterRequest.java:136)
at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:427)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.onRequestMessage(ServerOnRequestProcessor.java:116)
at io.seata.core.rpc.processor.server.ServerOnRequestProcessor.process(ServerOnRequestProcessor.java:77)
at io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
<==
10:55:08.016 INFO --- [ batchLoggerPrint_1_1] i.s.c.r.p.server.BatchLogHandler : SeataMergeMessage xid=192.168.158.80:8091:52710861745487872,branchType=AT,resourceId=jdbc:mysql://116.62.62.26/seata-storage,lockKey=storage:1,2,3,4,5
,clientIp:192.168.158.80,vgroup:default
本文地址:https://blog.csdn.net/weixin_39800144/article/details/108759561