Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark模式 #92

Closed
guonaihong opened this issue Nov 14, 2019 · 0 comments
Closed

benchmark模式 #92

guonaihong opened this issue Nov 14, 2019 · 0 comments

Comments

@guonaihong
Copy link
Owner

guonaihong commented Nov 14, 2019

设计思路:在原有的gout链式调用后面接Filter().Bench函数。可由普通的api接口转变为压测接口。
Filter().Bench是gout引入的第一个过滤器函数。
伪代码如下

控制benchmark时间

gout.
    GET(url).
    Filter().
    Bench(). // 打开bench过滤器
    Concurrent(20). // 并发数
    Durations(time.Second).
    Do()

控制benchmark次数

gout.
    GET(url).
    Filter().
    Bench(). // 打开bench过滤器
    Concurrent(20).// 并发数,业务很多返回一般设置为物理核心数 2倍的关系
    Number(100).  //压测次数
    Do()

控制发送速率

gout.GET(url).
      SetHeader(gout.H{"header1":"header-value"}).
      SetBody("hell world"). // http body 发送内容
      Filter().
      Bench().                       //打开bench过滤器
      Concurrent(20).           // 并发数,业务很多返回一般设置为物理核心数 2倍的关系
      Rate(1000).                  // 控制每秒压测频率
      Number(100000).        //压测次数
      Do()
guonaihong added a commit that referenced this issue Nov 21, 2019
guonaihong added a commit that referenced this issue Nov 22, 2019
guonaihong added a commit that referenced this issue Nov 23, 2019
guonaihong added a commit that referenced this issue Nov 26, 2019
guonaihong added a commit that referenced this issue Nov 28, 2019
guonaihong added a commit that referenced this issue Nov 29, 2019
@guonaihong guonaihong changed the title benckmark模式 benchmark模式 Dec 3, 2019
guonaihong added a commit that referenced this issue Dec 4, 2019
* update #92 benckmark

* update #92 benckmark

* update #92 benckmark

* update #92 benckmark

* update #92 benckmark

* update #92 benckmark

* update benckmark 后面就是提升测试覆盖度

* update benckmark 更新readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant