Thanks @AlmogBaku , Thanks. I'm glad the longest request is only 50% longer than squid.
I'd consider using https://github.com/giltene/wrk2 for a better latency analysis by Gil Tenne
the goproxy had lots of missed requests.. im seeing from the console this:
2016/03/09 12:31:51 [086] WARN: Error copying to client: read tcp 172.31.25.102:8080->198.27.114.146:34600: read tcp 172.31.25.102:49891->204.79.197.200:80: read: connection reset by peer
2016/03/09 12:31:52 [085] WARN: Error copying to client: read tcp 172.31.25.102:8080->198.27.114.146:34594: read tcp 172.31.25.102:49890->204.79.197.200:80: read: connection reset by peer
and
2016/03/09 12:32:29 [118] WARN: Error copying to client: read tcp 172.31.25.102:8080->158.69.118.48:50948: write tcp 172.31.25.102:8080->158.69.118.48:50948: use of closed network connection
2016/03/09 12:32:29 [117] WARN: Error copying to client: read tcp 172.31.25.102:8080->158.69.118.48:50646: write tcp 172.31.25.102:8080->158.69.118.48:50646: use of closed network connection
2016/03/09 13:12:01 http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 5ms
2016/03/09 13:12:01 http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 5ms
2016/03/09 13:12:01 http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 10ms
2016/03/09 13:12:02 http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 5ms
2016/03/09 13:12:02 http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 5ms
I executed the goproxy from root, and exectue ulimit -n 10240
before :|
open files while the stress test is around 1024:
root@ip-172-31-25-102:/home/ubuntu# lsof -p 3946|wc -l
1024
open files after is 13:root@ip-172-31-25-102:/home/ubuntu# lsof -p 3946|wc -l
13
limit:
root@ip-172-31-25-102:/home/ubuntu# ulimit -n
10240
untu@ip-172-31-25-103:~$ ab -c 700 -n 40000 -X go.proxy:8080 http://tapuz.co.il/
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking tapuz.co.il [through go.proxy:8080] (be patient)
Completed 4000 requests
Completed 8000 requests
Completed 12000 requests
Completed 16000 requests
Completed 20000 requests
Completed 24000 requests
Completed 28000 requests
Completed 32000 requests
Completed 36000 requests
Completed 40000 requests
Finished 40000 requests
Server Software:
Server Hostname: tapuz.co.il
Server Port: 80
Document Path: /
Document Length: 233 bytes
Concurrency Level: 700
Time taken for tests: 19.765 seconds
Complete requests: 40000
Failed requests: 0
Non-2xx responses: 40000
Total transferred: 20600000 bytes
HTML transferred: 9320000 bytes
Requests per second: 2023.76 [#/sec] (mean)
Time per request: 345.892 [ms] (mean)
Time per request: 0.494 [ms] (mean, across all concurrent requests)
Transfer rate: 1017.81 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 16 15.1 12 70
Processing: 107 325 124.5 299 1100
Waiting: 107 325 124.5 299 1100
Total: 107 341 128.0 315 1117
Percentage of the requests served within a certain time (ms)
50% 315
66% 386
75% 429
80% 457
90% 520
95% 574
98% 636
99% 681
100% 1117 (longest request)
root@ip-172-31-25-102:/home/ubuntu# ./goproxy-basic
2016/03/09 13:28:29 [180] WARN: Error copying to client: read tcp 172.31.25.102:8080->188.68.224.51:32895: write tcp 172.31.25.102:8080->188.68.224.51:32895: use of closed network connection
2016/03/09 13:29:34 [073] WARN: Error copying to client: read tcp 172.31.25.102:48632->212.74.50.1:443: write tcp 172.31.25.102:48632->212.74.50.1:443: use of closed network connection
2016/03/09 13:31:08 [081] WARN: Error copying to client: read tcp 172.31.25.102:8080->188.68.224.51:43394: write tcp 172.31.25.102:8080->188.68.224.51:43394: use of closed network connection
func isBlacklisted() goproxy.ReqCondition {
return goproxy.ReqConditionFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) bool {
return true;
})
}
proxy.OnRequest(isBlacklisted()).HandleConnect(goproxy.AlwaysReject)
isBlacklisted
func is being called but the ReqConditionFunc
is not, I have also tried that without the wrapper
Hello, my name is Liora and I am currently hunting open source projects for company NeuraLegion (www.neuralegion.com)
We just launched a free annual subscription for open source projects for our AIAST tool NexPloit.
If you are interested, please, reach us on opensource@neuralegion.com!
Thank you for your time and consideration! If you have any questions, please do not hesitate to contact us!
Best,
Hi
I am trying to cache request using elazarl/goproxy. If request is not cached, it needs to be routed through an external proxy.
proxy.OnRequest().DoFunc(func(req *http.Request,ctx *goproxy.ProxyCtx)(*http.Request,*http.Response) {
if alreadyCached {
return req, getCachedResponse(req)
}
//Here I want to route req via external proxy, I tried the following
transport := &http.Transport{Proxy: http.ProxyURL(proxyUrl), TLSClientConfig: &tls.Config{InsecureSkipVerify: true},}
proxtResponse, err := client.Do(proxyReq)
//cache the response
return req, response
}
But some sites are not loading properly on using the client.Do method.
Any suggestion to route http.Request via proxy.