Skip to content

change QPS threshold and failed RPS key updated #26

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

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/pkg/clients/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (h *HttpClient) Manager(ctx context.Context, conf models.Request, done chan
numOfClient := conf.Clients
var throttle <-chan time.Time
if conf.QPS > 0 {
throttle = time.Tick(time.Duration(1e6/conf.QPS) * time.Microsecond)
throttle = time.Tick(time.Duration(1e6/conf.QPS+1) * time.Microsecond)
}
var wg sync.WaitGroup
wg.Add(numOfClient)
Expand Down
2 changes: 1 addition & 1 deletion server/pkg/utils/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func init() {
}
httpClient = &http.Client{
Transport: tr,
Timeout: time.Second * 2,
Timeout: time.Second * 5,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
Expand Down
2 changes: 1 addition & 1 deletion server/pkg/utils/loadster.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func calculatePercentage(total int64, amount int64) int {
}

func calculateRpsForEachLoad(load models.Loadster) int64 {
endTime := load.Created
endTime := load.CreatedAt
startTime := load.StartTime
if load.Count > 0 && ((endTime-startTime)/1000) > 0 {
return (load.Count / ((endTime - startTime) / 1000))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function RequestStats() {
/>
<Stats
state={STATE.NAGATIVE}
value={loadsterRespons?.failRPS || 0}
value={loadsterRespons?.totalFailRPS || 0}
text="Failed RPS"
/>
</Box>
Expand Down