Giter VIP home page Giter VIP logo

grpc-go-polaris's People

Contributors

andrewshan avatar chuntaojun avatar houseme avatar hxchjm avatar ranchowang avatar shichaoyuan avatar wang007 avatar wtifs avatar xiaomingtom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grpc-go-polaris's Issues

动态路由和负载均衡未过滤异常节点

Describe the bug
节点异常关闭没有调用deRegister时,动态路由和负载均衡未过滤异常节点,导致访问出错

To Reproduce
按照 https://github.com/polarismesh/grpc-go-polaris/blob/main/examples/routing/README.md 中的流程启动三个provider和consumer之后,通过curl调用,正常返回结果
此时kill掉其中一个provider,之后多次curl调用发现会请求到已经被kill的异常节点(console后台状态显示为异常)

Expected behavior
希望官方可以修复此Bug

Environment

  • Version: [v1.4.0]
  • OS: [windows11]

Additional context
通过对balancer.go文件添加日志发现
pnp.balancer.routerAPI.ProcessRouters(request)
pnp.balancer.routerAPI.ProcessLoadBalance(lbReq)
这两个调用都没有过滤掉异常节点

plenty of optimize issues for gRPC-Go-Polaris

  1. all the providerapi, limitapi should not expose to user interface
  2. user can register the service as he use gRPC raw service
  3. optimize the client code, we should not connect to all servers by default
  4. optimize the client interface, we should encapsulated the consumerapi as well

熔断功能未生效

Describe the bug
A clear and concise description of what the bug is.

在配置中开启熔断功能,触发熔断后,客户端仍能访问到被熔断的实例

To Reproduce
Steps to reproduce the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • Version: [e.g. v1.0.0]
  • OS: [e.g. CentOS8]

Additional context
Add any other context about the problem here.

resolver在某些情况下会导致polaris后台卡住

Describe the bug

我参考polaris-go-grpc中的实现,在我的库项目woocoo集成了polaris支持,但在测试过程中发现经常发生的问题.测试方法在测试方法

To Reproduce

此测试方法主要: 1个服务的2个实例,1个客户端.通过实例的中断测试客户端访问是否正常.

  • 自身客户端卡住的同时也导致Polaris后台的服务界面查询卡住..中断测试时后台也恢复正常.
    推测是 在grpc server 关闭时,会执行unregister.此时会导致resolver ResolveNow 高频率的执行.可能导致大量的访问.
    这在以下位置使用time.sleep时出现.
[154		//time.Sleep(time.Second)](https://github.com/tsingsun/woocoo/blob/497566d6086e1dc2cb75b0afebc90c3419fc3638/contrib/polarismesh/client_test.go#L154)

建议是避免使用resolver.ResolverNow方法.

** 环境**
MacOS; docker desktop k8s; polaris k8s 部署

bug: resolver不断地增加cpu、套接字、内存占用

这里引用global.go的代码:

// PolarisContext get or init the global polaris context
func PolarisContext() (api.SDKContext, error) {
	mutexPolarisContext.Lock()
	defer mutexPolarisContext.Unlock()
	if nil != polarisContext {
		return polarisContext, nil
	}
	return api.InitContextByConfig(PolarisConfig())
}

还有resolver.go的代码:

func (pr *polarisNamingResolver) lookup() (*resolver.State, api.ConsumerAPI, error) {
	sdkCtx, err := PolarisContext()
	if nil != err {
		return nil, nil, err
	}
	consumerAPI := api.NewConsumerAPIByContext(sdkCtx)
	instancesRequest := &api.GetInstancesRequest{}
	instancesRequest.Namespace = getNamespace(pr.options)
	instancesRequest.Service = pr.target.URL.Host
	………………
	return state, consumerAPI, nil
}

func (pr *polarisNamingResolver) watcher() {
	……………………
	for {
		select {
		case <-pr.ctx.Done():
			return
		case <-pr.rn:
		case <-eventChan:
		}
		var state *resolver.State
		var err error
		state, consumerAPI, err = pr.lookup()
		……………………
	}
}

可以看到watcher协程每次有事件时都会调用 lookup进而调用PolarisContext,PolarisContext函数这里没有给 polarisContext 全局变量赋值,导致每次都要新建北极星sdk上下文,且不会销毁,导致cpu、套接字、内存泄漏,时间长了,进程崩溃。

客户端在进行grpc调用时与Polaris控制面8091端口的链接为短连接

Describe the bug
客户端在进行grpc调用时与Polaris控制面8091端口的链接为短连接

To Reproduce
持续grpc请求,netstat -ant发现很多TIME_WAIT链接.

Expected behavior
grpc-go-polaris与控制面的链接为长链接.

Environment

  • Version: [e.g. v1.4.0]
  • OS: [e.g. CentOS8]

Additional context
Add any other context about the problem here.

希望配置自定义,而不是依赖配置文件

希望支持 options 这种方式传参,sdk 不应该依赖配置文件和外部文件,希望把服务注册 和配置 中心变成插件化,可插拔,自己实现接口实现替换北极星部分功能,类似 go-micro 插件机制,把北极星当成控制平面使用

对接 v2 版的北极星服务报错

Describe the bug
A clear and concise description of what the bug is.

无法对接 v2 版的北极星服务

To Reproduce
使用 sdk 连接 v2 版的北极星系统。

Expected behavior

业务能够成功返回响应。

Got
错误如下

rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR

Environment

  • Version: v1.4.0
  • OS: Debian 11

Additional context
Add any other context about the problem here.

k8s 环境,polaris-server的服务名无法解析。

Describe the bug
同时 grpc-go-polaris 和 polaris-go 共存,服务名就无法解析了。grpc-go-polaris 版本是v1.2.2 polaris-go 版本是v1.1.0

To Reproduce
Steps to reproduce the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • go 1.18

Additional context
Add any other context about the problem here.

# grpc-go-polaris 支持服务预热 & 优雅下线

grpc-go-polaris 支持服务预热 & 优雅下线

目标

  • 服务预热:功能设计成开关的形式,默认关闭,允许用户通过开关或者注册 hook 来判断预热结束的标志,然后在正式发起服务注册
  • 优雅下线:功能设计成开关形式,默认开启,当实例停机下线时
    • 将实例在北极星进行反注册
    • 不再处理新的流量
    • 对于正在处理的流量,进行处理
    • 不能无限等待,需要有一个最大的等待时间

建议实现思路

  • 了解 grpc-go 的相关 interceptor 机制
  • 参考已有的服务预热 & 优雅下线实现

Originally posted by @chuntaojun in polarismesh/polaris#355 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.