Documentation ¶
Overview ¶
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2020 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Copyright 2021 GoFast Author(http://chende.ren). All rights reserved. Use of this source code is governed by a MIT license
Index ¶
- Variables
- func Breaker(kp *gate.RequestKeeper) fst.CtxHandler
- func Gunzip(useGunzip bool) fst.CtxHandler
- func HttpMaxConnections(limit int32) fst.HttpHandler
- func HttpMaxContentLength(limit int64) fst.HttpHandler
- func HttpReqCountPos(kp *gate.RequestKeeper, pos uint16) fst.HttpHandler
- func LoadShedding(kp *gate.RequestKeeper, useShedding bool, idx uint16) fst.CtxHandler
- func Logger(c *fst.Context)
- func LoggerMini(c *fst.Context)
- func MaxContentLength(c *fst.Context)
- func Prometheus(c *fst.Context)
- func Recovery(c *fst.Context)
- func ReqCount(kp *gate.RequestKeeper) fst.CtxHandler
- func ReqCountPos(kp *gate.RequestKeeper, idx uint16) fst.CtxHandler
- func TimeMetric(kp *gate.RequestKeeper) fst.CtxHandler
- func Timeout(kp *gate.RequestKeeper, useTimeout bool) fst.CtxHandler
- func TimeoutHandler(duration time.Duration) func(http.Handler) http.Handler
- func Tracing(appName string, useTracing bool) fst.CtxHandler
- type Attrs
Constants ¶
This section is empty.
Variables ¶
var AllAttrs allAttrs // 所有配置项汇总
Functions ¶
func Gunzip ¶
func Gunzip(useGunzip bool) fst.CtxHandler
func HttpMaxConnections ¶
func HttpMaxConnections(limit int32) fst.HttpHandler
限制最大并发连接数,相当于做一个请求资源数量连接池
func HttpReqCountPos ¶
func HttpReqCountPos(kp *gate.RequestKeeper, pos uint16) fst.HttpHandler
访问计数
func LoadShedding ¶
func LoadShedding(kp *gate.RequestKeeper, useShedding bool, idx uint16) fst.CtxHandler
自适应降载,前面熔断还是有一定比例的请求会通过。这里通过各种参数动态调整熔断的敏感度 可能参考指标: 1. cpu利用率 > 95% 2. 通过的请求中超时的比例 3. 处理超时的严重程度 4. 业务优先级 5. 用户优先级
func LoggerMini ¶
func Prometheus ¶
func ReqCount ¶
func ReqCount(kp *gate.RequestKeeper) fst.CtxHandler
func ReqCountPos ¶
func ReqCountPos(kp *gate.RequestKeeper, idx uint16) fst.CtxHandler
func TimeMetric ¶
func TimeMetric(kp *gate.RequestKeeper) fst.CtxHandler
++++++++++++++++++++++ add by cd.net 2021.10.14 总说:定时统计(间隔60秒)系统资源利用情况 | 请求处理相应性能 | 请求量 等
func Timeout ¶
func Timeout(kp *gate.RequestKeeper, useTimeout bool) fst.CtxHandler
方式二:设置请求处理的超时时间,单位是毫秒 TODO:注意下面的注释 NOTE:这个只是简易的方案,存在不严谨的情况。比如返回结果render了一部分,结果G被Cancel掉了。上面的标准库处理了这个问题。 方式一却自定义了 response write 加入了 输出缓存,返回结果全部好了之后才会一次性 render 给客户端。
func TimeoutHandler ¶
方式一:标准库 这种方式有个问题,大量请求其实是不会超时的,每次外面都包一层浪费资源