Skip to content

Commit

Permalink
Merge pull request #45 from sasile/master
Browse files Browse the repository at this point in the history
fix multi file support for performance worker
  • Loading branch information
sasile authored May 9, 2018
2 parents 4f92999 + d5d5467 commit 5eab75e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ http_blaster
#ignore iml
http_blaster.iml
BlasterDump-*
*results*
*results
5 changes: 2 additions & 3 deletions httpblaster/request_generators/performance_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,15 @@ func (self *PerformanceGenerator) clone_request(req *fasthttp.Request) *Request
}

func (self *PerformanceGenerator) single_file_submitter(ch_req chan *Request, req *fasthttp.Request, done chan struct{}) {

var generated int = 0
request := self.clone_request(req)
request.Request.SetHost(self.Host)
LOOP:
for {
select {
case <-done:
break LOOP
default:
request := self.clone_request(req)
request.Request.SetHost(self.Host)
if self.workload.Count == 0 {
ch_req <- request
generated += 1
Expand Down
15 changes: 2 additions & 13 deletions httpblaster/worker/perf_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ func (w *PerfWorker) RunWorker(ch_resp chan *request_generators.Response, ch_req
dump_requests bool,
dump_location string) {
defer wg.Done()
var oncePrepare sync.Once
var request *request_generators.Request
submit_request := request_generators.AcquireRequest()
var req_type sync.Once

do_once.Do(func() {
Expand All @@ -57,23 +54,15 @@ func (w *PerfWorker) RunWorker(ch_resp chan *request_generators.Response, ch_req
req_type.Do(func() {
w.Results.Method = string(req.Request.Header.Method())
})

oncePrepare.Do(func() {
request = req
request.Request.Header.CopyTo(&submit_request.Request.Header)
submit_request.Request.AppendBody(request.Request.Body())
submit_request.Request.SetHost(w.host)
})

err, d := w.send_request(submit_request, response)
err, d := w.send_request(req, response)

if err != nil{
log.Errorf("send request failed %s", err.Error())
}

ch_statuses <- response.Response.StatusCode()
ch_latency <- d

request_generators.ReleaseRequest(req)
response.Response.Reset()
}

Expand Down

0 comments on commit 5eab75e

Please sign in to comment.