Comments (23)
这里是不是没必要一直通过
msg := q.Dequeue() if msg == nil { break }
轮询有没有数据到达,在CallbackMessageQueue里面,使用一个channel在Enqueue有消息的时候,通知Dequeue取数据并返回,是不是就可以了?
from incubator-seata-go.
使用 channel 的话,如果 rpc stream 连接挂掉,定时任务往 channel 里放消息,会卡住程序
from incubator-seata-go.
有其他的任务的时候,这个 goroutine 会让出时间片,不会一直执行。要研究一下怎么优化它
from incubator-seata-go.
使用 channel 的话,如果 rpc stream 连接挂掉,定时任务往 channel 里放消息,会卡住程序
是说stream.Send报错吗?返回err 不是直接return掉了?
from incubator-seata-go.
@carlzhao 按你给的fix改了,CPU没有100%,但也是99%。:)
from incubator-seata-go.
把TC停掉,三个svc也基本把CPU占满了。
from incubator-seata-go.
因为要引入 grpc streaming 通信,grpc stream 的 gr 会一直去轮询有没有供发送的消息。尝试主动让出时间片,效果也不明显。
from incubator-seata-go.
@carlzhao 按你给的fix改了,CPU没有100%,但也是99%。:)
TC停掉,是因为连不上TC一直在空转,这是另一个锅,grpc.Dial没有通,但是没有返回err
你看下我这次的修复递交吧,carlzhao@8dd5a9b
from incubator-seata-go.
@carlzhao 按你给的fix改了,CPU没有100%,但也是99%。:)
TC停掉,是因为连不上TC一直在空转,这是另一个锅,grpc.Dial没有通,但是没有返回err
你看下我这次的修复递交吧,carlzhao@8dd5a9b
主要的修改在这里,去掉default,否则会一直空转
from incubator-seata-go.
@carlzhao 谢谢,晚点试下。
from incubator-seata-go.
@carlzhao 按你给的fix改了,CPU没有100%,但也是99%。:)
TC停掉,是因为连不上TC一直在空转,这是另一个锅,grpc.Dial没有通,但是没有返回err
你看下我这次的修复递交吧,carlzhao@8dd5a9b主要的修改在这里,去掉default,否则会一直空转
这个解决问题吗,能的话提个 pr 吧
from incubator-seata-go.
错吗?返回err 不是直接return掉了?
是的,他直接 return 了,还有个异步重试的 gr 在往 branchMessages 里发消息,如果改成 channel 可能阻塞
from incubator-seata-go.
@carlzhao 按你给的fix改了,CPU没有100%,但也是99%。:)
TC停掉,是因为连不上TC一直在空转,这是另一个锅,grpc.Dial没有通,但是没有返回err
你看下我这次的修复递交吧,carlzhao@8dd5a9b这个解决问题吗,能的话提个 pr 吧
能解决,我递交了一个pr,自测过tc和samples工程cpu消耗都降下来了
from incubator-seata-go.
@carlzhao 还有个问题,我想了一下是可以用 channel 的,这块是我想错了,刚测试了一下换 channel 也没问题。稍后我更新下代码。
from incubator-seata-go.
@carlzhao @Leadrive 试试 2.0.4-rc1 版本
from incubator-seata-go.
试了rc1,CPU降下来了,但测试发现sample回滚失败。
我在那边提交了一个issue,麻烦看看。
from incubator-seata-go.
WIN10,机器睡眠后,今天打开机器。3个svc又把CPU占满了。此时TC没开
INFO: 2021/09/19 08:14:14 [core] Subchannel Connectivity change to CONNECTING
INFO: 2021/09/19 08:14:14 [core] Subchannel picks a new address "localhost:8091" to connect
INFO: 2021/09/19 08:14:14 [core] pickfirstBalancer: UpdateSubConnState: 0xc0004ae110, {CONNECTING <nil>}
INFO: 2021/09/19 08:14:14 [core] Channel Connectivity change to CONNECTING
WARNING: 2021/09/19 08:14:16 [core] grpc: addrConn.createTransport failed to connect to {localhost:8091 localhost:8091 <nil> 0 <nil>}. Err: connection error: desc = "transport: Error while dialing dial tcp [::1]:8091: connectex: No connection could be made because the target machine actively refused it.". Reconnecting...
INFO: 2021/09/19 08:14:16 [core] Subchannel Connectivity change to TRANSIENT_FAILURE
INFO: 2021/09/19 08:14:16 [core] pickfirstBalancer: UpdateSubConnState: 0xc0004ae110, {TRANSIENT_FAILURE connection error: desc = "transport: Error while dialing dial tcp [::1]:8091: connectex: No connection could be made because the target machine actively refused it."}
INFO: 2021/09/19 08:14:16 [core] Channel Connectivity change to TRANSIENT_FAILURE
再打开TC,过几分钟连上TC后,CPU降下来了。看来没连上TC的情况,要考虑一下。
from incubator-seata-go.
WIN10,机器睡眠后,今天打开机器。3个svc又把CPU占满了。此时TC没开
INFO: 2021/09/19 08:14:14 [core] Subchannel Connectivity change to CONNECTING INFO: 2021/09/19 08:14:14 [core] Subchannel picks a new address "localhost:8091" to connect INFO: 2021/09/19 08:14:14 [core] pickfirstBalancer: UpdateSubConnState: 0xc0004ae110, {CONNECTING <nil>} INFO: 2021/09/19 08:14:14 [core] Channel Connectivity change to CONNECTING WARNING: 2021/09/19 08:14:16 [core] grpc: addrConn.createTransport failed to connect to {localhost:8091 localhost:8091 <nil> 0 <nil>}. Err: connection error: desc = "transport: Error while dialing dial tcp [::1]:8091: connectex: No connection could be made because the target machine actively refused it.". Reconnecting... INFO: 2021/09/19 08:14:16 [core] Subchannel Connectivity change to TRANSIENT_FAILURE INFO: 2021/09/19 08:14:16 [core] pickfirstBalancer: UpdateSubConnState: 0xc0004ae110, {TRANSIENT_FAILURE connection error: desc = "transport: Error while dialing dial tcp [::1]:8091: connectex: No connection could be made because the target machine actively refused it."} INFO: 2021/09/19 08:14:16 [core] Channel Connectivity change to TRANSIENT_FAILURE再打开TC,过几分钟连上TC后,CPU降下来了。看来没连上TC的情况,要考虑一下。
这种情况有什么好的优化方法没啊
from incubator-seata-go.
WIN10,机器睡眠后,今天打开机器。3个svc又把CPU占满了。此时TC没开
INFO: 2021/09/19 08:14:14 [core] Subchannel Connectivity change to CONNECTING INFO: 2021/09/19 08:14:14 [core] Subchannel picks a new address "localhost:8091" to connect INFO: 2021/09/19 08:14:14 [core] pickfirstBalancer: UpdateSubConnState: 0xc0004ae110, {CONNECTING <nil>} INFO: 2021/09/19 08:14:14 [core] Channel Connectivity change to CONNECTING WARNING: 2021/09/19 08:14:16 [core] grpc: addrConn.createTransport failed to connect to {localhost:8091 localhost:8091 <nil> 0 <nil>}. Err: connection error: desc = "transport: Error while dialing dial tcp [::1]:8091: connectex: No connection could be made because the target machine actively refused it.". Reconnecting... INFO: 2021/09/19 08:14:16 [core] Subchannel Connectivity change to TRANSIENT_FAILURE INFO: 2021/09/19 08:14:16 [core] pickfirstBalancer: UpdateSubConnState: 0xc0004ae110, {TRANSIENT_FAILURE connection error: desc = "transport: Error while dialing dial tcp [::1]:8091: connectex: No connection could be made because the target machine actively refused it."} INFO: 2021/09/19 08:14:16 [core] Channel Connectivity change to TRANSIENT_FAILURE再打开TC,过几分钟连上TC后,CPU降下来了。看来没连上TC的情况,要考虑一下。
这种情况有什么好的优化方法没啊
看下是不是这里导致的啊,我之前遇到的是连不上tc,这里就会循环err,然后continue,加行日志可以看到。
manager.rpcClient.BranchCommunicate(ctx)
这种可以在grpc连的时候就采用grpc.WithBlock()的方式保证连成功, 或是断连的时候,重新自动延迟重连
from incubator-seata-go.
@carlzhao ,要不你重新提个 pr。之前那个因为我已经改了就没合了。
from incubator-seata-go.
@dk-lockdown 下次跟别的一起修复下吧,我就不提pr了,没多少修改 ^_^
from incubator-seata-go.
@carlzhao 那我就关闭这个 issue 了哦
from incubator-seata-go.
好的
from incubator-seata-go.
Related Issues (20)
- Statelang module in Saga mode HOT 1
- State machine configuration in seata-go Saga HOT 1
- Database persistence for seata-go Saga state machine HOT 1
- Service invocation (RPC) in both seata-go and seata Saga HOT 1
- Expression integration with CEL in seata-go Saga HOT 1
- Sequential execution of state machine in seata-go Saga HOT 1
- Compensatory and forward operations in seata-go Saga
- gorm使用seata分布式事务报空指针 HOT 1
- AT不填默认主键,insert的时候会panic HOT 1
- feature/saga branch import cycles need to be breaked HOT 1
- Use undo compress type config usage HOT 2
- bugfix: rollback active xa connection fail HOT 3
- feature: support contextPath parameter to Nacos client HOT 1
- undo log parser type jackson not found HOT 2
- Is AT mode working for multiple services invoke chain? HOT 1
- rename seata-go module name
- fix AT mode "undo log parser type jackson not found" error HOT 1
- XA ExecContext 没有正确处理 err
- XA 相同的DB执行两条sql时报错 HOT 1
- 测试一个长时间运行的sql,timeout时,xa是否正确处理回滚遇到报错
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incubator-seata-go.