You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @bitker. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it!
你好 @bitker。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
@bitker
Sorry, I'm late. I missed some issue messages due to lost emails.
This is very good advice! This capability can be extended in the form of middleware. In fact, it is relatively simple to develop this timeout middleware logic. grpc has good scalability through the interceptor mechanism. At the same time, gclient of the goframe framework also implements the interceptor/middleware mechanism, so the framework gives priority to scalability. These implementations can rely on the community Come build together. If you want to implement it, it is recommended to implement both grpc and http. Everyone is welcome to build it together.
建议GRPC服务端加入超时限制。
防止某些情况下导致服务端执行耗时阻塞任务时,客户端长时间链接导致资源浪费。
某些场景:如服务端在执行CURL任务时可能会有很久的延时(当然是开发者没有设置超时限制)。这样会导致很多客户端一直等待。
个人经历:某次开发时使用了gcahe中的GetOrSetFuncLock这个函数,由于此函数中又执行了CURL请求,最后导致了大批量并发链接等待。当时我个人原因没有注意到此函数会阻塞等待,导致了客户端很多链接在等待处理(经查发现等待了半小时没有返回)。后来切换gozero后没有出现长时等待。经复盘发现gozero的服务端是有超时设置
可能很多人会说客户端链接时可以设置ctx的超时控制。我也知道这个,但是如果有个别开发者粗心没有设置此超时的话将会导致大量链接等待了。
gozero的服务端超时控制是在中间件中将ctx上下重新设置超时控制。以下是部分gozero的超时控制流程。
希望哪位大佬 能改个加入gf的grpc就完美了
The text was updated successfully, but these errors were encountered: