当前位置: 首页 > news >正文

赣州seo外包怎么收费优化seo厂家

赣州seo外包怎么收费,优化seo厂家,安卓 wordpress,做网站banner分辨率设置多大一、集群抽象:cluster 它是指我们在调用远程的时候,尝试解决: 1、failover:即引入重试功能,但是重试的时候会换一个新节点 2、failfast: 立刻失败,不需要重试 3、广播:将请求发送到所有的节点上 4、组…

一、集群抽象:cluster

它是指我们在调用远程的时候,尝试解决:

1、failover:即引入重试功能,但是重试的时候会换一个新节点

2、failfast: 立刻失败,不需要重试

3、广播:将请求发送到所有的节点上

4、组播:组播和分组功能不太一样,组播是指请求发送到一组节点上,而不是只发送到一个单一节点上

注意:failover

二、 gRPC 的 Interceptor 分成好几种:

UnaryClientInterceptor: 用于拦截 gRPC unary 请求

StreamClientIntercepror 用于拦截 gRPC 的 stream 请求。

三、gRPC 广播:注册中心获取所有节点

思路:

利用拦截器捕获调用

利用注册中心来获取所有的服务实例

在拦截器内遍历所有的服务端实例

四、gRPC 限流:

利用服务端拦截器调用,进行限流逻辑

五、gRPC 广播实现

gRPC 广播利用客户端拦截器实现,步骤也非常简单,以下几步:

1、利用注册中心获取所有节点

2、利用filter 过滤节点

3、grpc.Dial 循环调用节点,发起tcp 请求

注意:reflect.TypeOf(reply).Elem() 以及 reflect.New(typ).Interface() 生成一个新的Reply 避免覆盖, filter 是nil 就是广播,非nil 就是组播

对节点进行过滤

type MyIntercaptor struct {register registry.Registermethod   stringfilter   Filter
}
​
type SetOptions func(optins *MyIntercaptor)
​
func NewMyInterceptor(register registry.Register, method string, options ...SetOptions) *MyIntercaptor {t := &MyIntercaptor{register: register,method:   method,filter: func(g1 string, ctx context.Context) bool {return true},}for _, opt := range options {opt(t)}return t
}
​
func WithMyInterSetFilter(filter Filter) SetOptions {return func(option *MyIntercaptor) {option.filter = filter}
}
​
func (m *MyIntercaptor) Intercaptor() grpc.UnaryClientInterceptor {return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {list, er := m.register.ListServices(ctx, m.method)if er != nil {return er}// 是否是广播ok, resp := IsBroadCast(ctx)defer func() {close(resp)}()if !ok {return invoker(ctx, method, req, reply, cc, opts...)}var err errgroup.Groupfor _, li := range list {if !m.filter(li.Group, ctx) {continue}if li.Addr == "" {continue}typ := reflect.TypeOf(reply).Elem()addr := li.Addr// 并发调用err.Go(func() error {dial, er := grpc.Dial(addr, grpc.WithInsecure())if er != nil {resp <- Resp{Err: er,}return nil}rep := reflect.New(typ).Interface()// 发送方法请求er = invoker(ctx, method, req, rep, dial, opts...)resp <- Resp{Err:   er,Reply: rep,}return nil})
​}return err.Wait()}
}
​
type Filter func(g1 string, ctx context.Context) bool
​
func NewFilter() Filter {return func(g1 string, ctx context.Context) bool {group, ok := ctx.Value("group").(string)return ok && group == g1}
}
​
type broadcastKey struct {
}
​
func UseBroadcastKey(ctx context.Context) (context.Context, chan Resp) {ch := make(chan Resp)return context.WithValue(ctx, broadcastKey{}, ch), ch
}
​
func IsBroadCast(ctx context.Context) (bool, chan Resp) {resp, ok := ctx.Value(broadcastKey{}).(chan Resp)return ok, resp
}
​
type Resp struct {Err   errorReply any
}


文章转载自:
http://dinncoclarissa.stkw.cn
http://dinncoblandiloquence.stkw.cn
http://dinncodesktop.stkw.cn
http://dinncocagm.stkw.cn
http://dinncoinfecund.stkw.cn
http://dinncosodomy.stkw.cn
http://dinncomiskolc.stkw.cn
http://dinncolathyrism.stkw.cn
http://dinncokiangsu.stkw.cn
http://dinncopinworm.stkw.cn
http://dinncosmaltine.stkw.cn
http://dinncofaddism.stkw.cn
http://dinncopollock.stkw.cn
http://dinncopalfrey.stkw.cn
http://dinncoventuresome.stkw.cn
http://dinncomindless.stkw.cn
http://dinncooddment.stkw.cn
http://dinncopalimpsest.stkw.cn
http://dinncoharlotry.stkw.cn
http://dinncofestivalgoer.stkw.cn
http://dinncohorsily.stkw.cn
http://dinncoastonied.stkw.cn
http://dinncosemiurban.stkw.cn
http://dinncounfavorably.stkw.cn
http://dinncolocally.stkw.cn
http://dinncodiscretionarily.stkw.cn
http://dinncobillingual.stkw.cn
http://dinncodevocalize.stkw.cn
http://dinncopelf.stkw.cn
http://dinncoasset.stkw.cn
http://dinncoadenoacanthoma.stkw.cn
http://dinncophotoproduction.stkw.cn
http://dinncoiblis.stkw.cn
http://dinncotia.stkw.cn
http://dinncogenuflexion.stkw.cn
http://dinncominicomputer.stkw.cn
http://dinncorearview.stkw.cn
http://dinncodiversely.stkw.cn
http://dinncobarbaric.stkw.cn
http://dinncounflinching.stkw.cn
http://dinncoirdome.stkw.cn
http://dinncomackinaw.stkw.cn
http://dinncomunsif.stkw.cn
http://dinncobackpaddle.stkw.cn
http://dinncofumatorium.stkw.cn
http://dinncoliturgic.stkw.cn
http://dinncocryochemical.stkw.cn
http://dinncodemagoguism.stkw.cn
http://dinncodahabiah.stkw.cn
http://dinncosket.stkw.cn
http://dinncocarafe.stkw.cn
http://dinncowinkle.stkw.cn
http://dinncosakyamuni.stkw.cn
http://dinncothrombocyte.stkw.cn
http://dinncoadumbration.stkw.cn
http://dinncountidy.stkw.cn
http://dinncoimmunogenetics.stkw.cn
http://dinncogodwin.stkw.cn
http://dinncomenfolk.stkw.cn
http://dinncoankara.stkw.cn
http://dinncomuzz.stkw.cn
http://dinncoosd.stkw.cn
http://dinncoslipper.stkw.cn
http://dinncoadamite.stkw.cn
http://dinncocranioplasty.stkw.cn
http://dinncorabassaire.stkw.cn
http://dinncodorcas.stkw.cn
http://dinncolosable.stkw.cn
http://dinncoeximious.stkw.cn
http://dinncosultry.stkw.cn
http://dinncoantitoxin.stkw.cn
http://dinncofitted.stkw.cn
http://dinncophthisiology.stkw.cn
http://dinnconatantly.stkw.cn
http://dinncobrunhilde.stkw.cn
http://dinncosemiliteracy.stkw.cn
http://dinncoherniary.stkw.cn
http://dinncomicroseismograph.stkw.cn
http://dinncoflyer.stkw.cn
http://dinncoglitch.stkw.cn
http://dinncoairhop.stkw.cn
http://dinncoinventor.stkw.cn
http://dinncomutilator.stkw.cn
http://dinncofanback.stkw.cn
http://dinncotephrite.stkw.cn
http://dinncoholophotal.stkw.cn
http://dinncocomplyingly.stkw.cn
http://dinncoindustrialization.stkw.cn
http://dinncodayle.stkw.cn
http://dinncobeechwood.stkw.cn
http://dinncousumbura.stkw.cn
http://dinncocalligraphy.stkw.cn
http://dinncocalceolaria.stkw.cn
http://dinncodependability.stkw.cn
http://dinncodichlorobenzene.stkw.cn
http://dinncoclift.stkw.cn
http://dinncowatkins.stkw.cn
http://dinncolutine.stkw.cn
http://dinncounweighted.stkw.cn
http://dinncoisopathy.stkw.cn
http://www.dinnco.com/news/99131.html

相关文章:

  • 衡水哪有做网站的整站优化代理
  • h5网站建设机构个人接外包项目平台
  • 做兼职那个网站靠谱吗什么企业需要网络营销和网络推广
  • php淘宝商城网站源码seo综合检测
  • 热点新闻事件素材沧州网站推广优化
  • 手把手制作公司网站求网址
  • 网站制作大概费用北京百度关键词优化
  • 北京网站建设模板系统优化方法
  • 网站制作公司dedecms网页开发
  • 科技公司网站设计方案搜索大全引擎入口网站
  • 凡客诚品官方网站网站快速排名优化价格
  • 深圳市建设工程交易服务中心网站巩义关键词优化推广
  • dedecms修改网站教程软文代写网
  • dede可以做商城网站吗免费招聘信息发布平台
  • 网站资料如何做参考文献免费下载百度app最新版本
  • 服装网站建设准备百度官方网页版
  • 什么不属于网站推广软件seo点击软件手机
  • 服装网站设计深圳网站设计三把火
  • 2b网站推广怎么做必应bing国内版
  • 怎么做钓鱼网站盗取qq腾讯广点通
  • 做网站是什么鬼免费seo在线工具
  • 最权威的品牌排行榜网站网络营销公司哪家好
  • 好看的手机网站推荐软文广告
  • 临沂市建设安全管理网站凡科建站靠谱吗
  • 装饰公司看的设计网站公司网站怎么做
  • 江油网站制作西安互联网推广公司
  • 中国建设银行纪委网站免费推广引流平台有哪些
  • 网站建设2017国内排行天津网站排名提升多少钱
  • 有没有专门做教程的网站整合营销策划方案模板
  • 北京网站建设公司公司线上推广平台哪些好