diff --git a/.gitignore b/.gitignore index c4afb41..b3d0379 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ http_blaster #ignore iml http_blaster.iml BlasterDump-* -*results* \ No newline at end of file +*results \ No newline at end of file diff --git a/httpblaster/request_generators/performance_generator.go b/httpblaster/request_generators/performance_generator.go index 56ec60e..420690c 100644 --- a/httpblaster/request_generators/performance_generator.go +++ b/httpblaster/request_generators/performance_generator.go @@ -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 diff --git a/httpblaster/worker/perf_worker.go b/httpblaster/worker/perf_worker.go index 00fd1e2..aff8fb0 100644 --- a/httpblaster/worker/perf_worker.go +++ b/httpblaster/worker/perf_worker.go @@ -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() { @@ -57,15 +54,7 @@ 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()) @@ -73,7 +62,7 @@ func (w *PerfWorker) RunWorker(ch_resp chan *request_generators.Response, ch_req ch_statuses <- response.Response.StatusCode() ch_latency <- d - + request_generators.ReleaseRequest(req) response.Response.Reset() }