Parallel proxied requests are run in groups of 2
See original GitHub issueWe’ve noticed that when requesting in parallel, the request from Wiremock to HAProxy (in our example), is batching only 2 requests at a time. The expectation would be that Wiremock sends all/any requests to proxy, without any blocking.
I’ve provided an example setup to reproduce the issue at https://github.com/jgornick/wiremock-haproxy/tree/response-delay.
Some notes about the environment:
- Wiremock 2.27.1 & HAProxy 2.1.3
- HAProxy is configured to delay every request by 2s
- Wiremock options are tuned in Dockerfile to:
- Enable “async” responses
- Increase container threads
- Increase Jetty threads
Follow the README to setup the environment and start the test.
Looking at the output from the containers, we can see that Wiremock is sending only 2 requests to HAProxy and then waiting for those requests to finish before sending 2 more:
wiremock-server_1 | 2020-07-23 14:29:16.372 Proxying: GET http://haproxy:3128/v1/public/coin/5
wiremock-server_1 | 2020-07-23 14:29:16.373 Proxying: GET http://haproxy:3128/v1/public/coin/3
haproxy_1 | 0000007b:fe.accept(0006)=0012 from [::ffff:192.168.16.3:49090] ALPN=<none>
wiremock-server_1 | 2020-07-23 14:29:16.381 Proxying: GET http://haproxy:3128/v1/public/coin/4
haproxy_1 | 0000007c:fe.accept(0006)=0014 from [::ffff:192.168.16.3:49092] ALPN=<none>
wiremock-server_1 | 2020-07-23 14:29:16.391 Proxying: GET http://haproxy:3128/v1/public/coin/10
wiremock-server_1 | 2020-07-23 14:29:16.393 Proxying: GET http://haproxy:3128/v1/public/coin/2
wiremock-server_1 | 2020-07-23 14:29:16.396 Proxying: GET http://haproxy:3128/v1/public/coin/8
wiremock-server_1 | 2020-07-23 14:29:16.400 Proxying: GET http://haproxy:3128/v1/public/coin/1
wiremock-server_1 | 2020-07-23 14:29:16.399 Proxying: GET http://haproxy:3128/v1/public/coin/9
wiremock-server_1 | 2020-07-23 14:29:16.399 Proxying: GET http://haproxy:3128/v1/public/coin/6
wiremock-server_1 | 2020-07-23 14:29:16.399 Proxying: GET http://haproxy:3128/v1/public/coin/7
wiremock-server_1 | 2020-07-23 14:29:18.366 Proxying: GET http://haproxy:3128/todos/22929
haproxy_1 | 0000007b:fe.clireq[0012:ffffffff]: GET /v1/public/coin/5 HTTP/1.1
haproxy_1 | 0000007b:fe.clihdr[0012:ffffffff]: accept: */*
haproxy_1 | 0000007b:fe.clihdr[0012:ffffffff]: user-agent: curl/7.54.0
haproxy_1 | 0000007b:fe.clihdr[0012:ffffffff]: host: api.coinranking.com
haproxy_1 | 0000007c:fe.clireq[0014:ffffffff]: GET /v1/public/coin/3 HTTP/1.1
haproxy_1 | 0000007c:fe.clihdr[0014:ffffffff]: accept: */*
haproxy_1 | 0000007c:fe.clihdr[0014:ffffffff]: user-agent: curl/7.54.0
haproxy_1 | 0000007c:fe.clihdr[0014:ffffffff]: host: api.coinranking.com
haproxy_1 | 0000007c:be.srvrep[0014:0016]: HTTP/1.1 200 OK
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: content-type: application/json; charset=utf-8
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: content-length: 2910
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-Access-Token
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: access-control-allow-methods: GET, POST, OPTIONS, PATCH, DELETE
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: access-control-allow-origin: *
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: cache-control: max-age=60
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: date: Thu, 23 Jul 2020 14:29:22 GMT
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: etag: W/"b5e-1DyYBWVCJ21dnuxDpUALzlh0USw"
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: x-rate-score: 8.466ms
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: vary: Accept-Encoding
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: x-cache: Miss from cloudfront
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: via: 1.1 8780431c9da5d53b39c3ac8bc25b743b.cloudfront.net (CloudFront)
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: x-amz-cf-pop: ORD52-C1
haproxy_1 | 0000007c:be.srvhdr[0014:0016]: x-amz-cf-id: qQ4FsbX-QYN-usg3IbRQ1fk75I2CVMGFKhFJICn8VdWfWLlPhToZ0g==
haproxy_1 | 0000007c:be.srvcls[0014:0016]
haproxy_1 | 0000007c:be.clicls[0014:0016]
haproxy_1 | 0000007c:be.closed[0014:0016]
haproxy_1 | <134>Jul 23 14:29:19 haproxy[6]: ::ffff:192.168.16.3:49092 [23/Jul/2020:14:29:16.397] fe be/clear 2086/0/308/221/2615 200 3538 - - ---- 2/2/1/1/0 0/0 {13.249.94.113} "GET /v1/public/coin/3 HTTP/1.1"
haproxy_1 | 0000007d:fe.accept(0006)=0014 from [::ffff:192.168.16.3:49092] ALPN=<none>
haproxy_1 | 0000007d:fe.clicls[0014:ffffffff]
haproxy_1 | 0000007d:fe.closed[0014:ffffffff]
wiremock-server_1 | 2020-07-23 14:29:19.015 Request received:
wiremock-server_1 | 192.168.16.1 - GET /v1/public/coin/3
wiremock-server_1 |
wiremock-server_1 | Accept: [*/*]
wiremock-server_1 | User-Agent: [curl/7.54.0]
wiremock-server_1 | Host: [api.coinranking.com]
wiremock-server_1 |
wiremock-server_1 |
wiremock-server_1 |
wiremock-server_1 | Matched response definition:
wiremock-server_1 | {
wiremock-server_1 | "status" : 200,
wiremock-server_1 | "proxyBaseUrl" : "http://haproxy:3128"
wiremock-server_1 | }
wiremock-server_1 |
wiremock-server_1 | Response:
wiremock-server_1 | HTTP/1.1 200
wiremock-server_1 | content-type: [application/json; charset=utf-8]
wiremock-server_1 | cache-control: [max-age=60]
wiremock-server_1 | date: [Thu, 23 Jul 2020 14:29:22 GMT]
wiremock-server_1 | etag: [W/"b5e-1DyYBWVCJ21dnuxDpUALzlh0USw"]
wiremock-server_1 | x-rate-score: [8.466ms]
wiremock-server_1 | vary: [Accept-Encoding]
wiremock-server_1 | x-cache: [Miss from cloudfront]
wiremock-server_1 | via: [1.1 8780431c9da5d53b39c3ac8bc25b743b.cloudfront.net (CloudFront)]
wiremock-server_1 | x-amz-cf-pop: [ORD52-C1]
wiremock-server_1 | x-amz-cf-id: [qQ4FsbX-QYN-usg3IbRQ1fk75I2CVMGFKhFJICn8VdWfWLlPhToZ0g==]
wiremock-server_1 |
wiremock-server_1 |
haproxy_1 | 0000007e:fe.accept(0006)=0014 from [::ffff:192.168.16.3:49102] ALPN=<none>
haproxy_1 | 0000007b:be.srvrep[0012:0015]: HTTP/1.1 200 OK
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: content-type: application/json; charset=utf-8
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: content-length: 3401
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-Access-Token
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: access-control-allow-methods: GET, POST, OPTIONS, PATCH, DELETE
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: access-control-allow-origin: *
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: cache-control: max-age=60
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: date: Thu, 23 Jul 2020 14:29:22 GMT
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: etag: W/"d49-K5MGaME1jLCrSxqGqFTC51hsQDI"
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: x-rate-score: 9.311ms
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: vary: Accept-Encoding
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: x-cache: Miss from cloudfront
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: via: 1.1 b89903d8d440c2d657cc902d956ab98f.cloudfront.net (CloudFront)
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: x-amz-cf-pop: ORD52-C1
haproxy_1 | 0000007b:be.srvhdr[0012:0015]: x-amz-cf-id: RYOoT0dU-3BfeTuAylkRWkKmfsOfDmYq11wsuKSte9QXMgHEAwOH9A==
haproxy_1 | 0000007b:be.srvcls[0012:0015]
haproxy_1 | 0000007b:be.clicls[0012:0015]
haproxy_1 | 0000007b:be.closed[0012:0015]
haproxy_1 | <134>Jul 23 14:29:19 haproxy[6]: ::ffff:192.168.16.3:49090 [23/Jul/2020:14:29:16.385] fe be/clear 2097/0/316/232/2645 200 4029 - - ---- 2/2/0/0/0 0/0 {13.249.94.18} "GET /v1/public/coin/5 HTTP/1.1"
haproxy_1 | 0000007f:fe.accept(0006)=0012 from [::ffff:192.168.16.3:49090] ALPN=<none>
haproxy_1 | 0000007f:fe.clicls[0012:ffffffff]
haproxy_1 | 0000007f:fe.closed[0012:ffffffff]
wiremock-server_1 | 2020-07-23 14:29:19.039 Request received:
wiremock-server_1 | 192.168.16.1 - GET /v1/public/coin/5
wiremock-server_1 |
wiremock-server_1 | Accept: [*/*]
wiremock-server_1 | User-Agent: [curl/7.54.0]
wiremock-server_1 | Host: [api.coinranking.com]
wiremock-server_1 |
wiremock-server_1 |
wiremock-server_1 |
wiremock-server_1 | Matched response definition:
wiremock-server_1 | {
wiremock-server_1 | "status" : 200,
wiremock-server_1 | "proxyBaseUrl" : "http://haproxy:3128"
wiremock-server_1 | }
wiremock-server_1 |
wiremock-server_1 | Response:
wiremock-server_1 | HTTP/1.1 200
wiremock-server_1 | content-type: [application/json; charset=utf-8]
wiremock-server_1 | cache-control: [max-age=60]
wiremock-server_1 | date: [Thu, 23 Jul 2020 14:29:22 GMT]
wiremock-server_1 | etag: [W/"d49-K5MGaME1jLCrSxqGqFTC51hsQDI"]
wiremock-server_1 | x-rate-score: [9.311ms]
wiremock-server_1 | vary: [Accept-Encoding]
wiremock-server_1 | x-cache: [Miss from cloudfront]
wiremock-server_1 | via: [1.1 b89903d8d440c2d657cc902d956ab98f.cloudfront.net (CloudFront)]
wiremock-server_1 | x-amz-cf-pop: [ORD52-C1]
wiremock-server_1 | x-amz-cf-id: [RYOoT0dU-3BfeTuAylkRWkKmfsOfDmYq11wsuKSte9QXMgHEAwOH9A==]
wiremock-server_1 |
wiremock-server_1 |
haproxy_1 | 00000080:fe.accept(0006)=0015 from [::ffff:192.168.16.3:49104] ALPN=<none>
haproxy_1 | 0000007e:fe.clireq[0014:ffffffff]: GET /v1/public/coin/4 HTTP/1.1
haproxy_1 | 0000007e:fe.clihdr[0014:ffffffff]: accept: */*
haproxy_1 | 0000007e:fe.clihdr[0014:ffffffff]: user-agent: curl/7.54.0
haproxy_1 | 0000007e:fe.clihdr[0014:ffffffff]: host: api.coinranking.com
haproxy_1 | 00000080:fe.clireq[0015:ffffffff]: GET /v1/public/coin/10 HTTP/1.1
haproxy_1 | 00000080:fe.clihdr[0015:ffffffff]: accept: */*
haproxy_1 | 00000080:fe.clihdr[0015:ffffffff]: user-agent: curl/7.54.0
haproxy_1 | 00000080:fe.clihdr[0015:ffffffff]: host: api.coinranking.com
haproxy_1 | 0000007e:be.srvrep[0014:0012]: HTTP/1.1 200 OK
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: content-type: application/json; charset=utf-8
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: content-length: 3340
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-Access-Token
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: access-control-allow-methods: GET, POST, OPTIONS, PATCH, DELETE
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: access-control-allow-origin: *
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: cache-control: max-age=60
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: date: Thu, 23 Jul 2020 14:29:24 GMT
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: etag: W/"d0c-kU0R1br1Tp1LNUzi2p35SAjZcx8"
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: x-rate-score: 7.272ms
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: vary: Accept-Encoding
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: x-cache: Miss from cloudfront
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: via: 1.1 be9e8198c11c3aefc38245bb41391566.cloudfront.net (CloudFront)
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: x-amz-cf-pop: ORD52-C1
haproxy_1 | 0000007e:be.srvhdr[0014:0012]: x-amz-cf-id: 1Lyp4dpTac_iy_XD4Md-XORflT0ol74awoeUi3Ra6n8s09qndjUOnw==
haproxy_1 | 0000007e:be.srvcls[0014:0012]
haproxy_1 | 0000007e:be.clicls[0014:0012]
haproxy_1 | 0000007e:be.closed[0014:0012]
haproxy_1 | <134>Jul 23 14:29:21 haproxy[6]: ::ffff:192.168.16.3:49102 [23/Jul/2020:14:29:19.017] fe be/clear 2010/0/295/218/2523 200 3968 - - ---- 2/2/1/1/0 0/0 {13.249.94.18} "GET /v1/public/coin/4 HTTP/1.1"
haproxy_1 | 00000081:fe.accept(0006)=0014 from [::ffff:192.168.16.3:49102] ALPN=<none>
haproxy_1 | 00000081:fe.clicls[0014:ffffffff]
haproxy_1 | 00000081:fe.closed[0014:ffffffff]
haproxy_1 | 00000082:fe.accept(0006)=0012 from [::ffff:192.168.16.3:49110] ALPN=<none>
wiremock-server_1 | 2020-07-23 14:29:21.543 Request received:
wiremock-server_1 | 192.168.16.1 - GET /v1/public/coin/4
wiremock-server_1 |
wiremock-server_1 | Accept: [*/*]
wiremock-server_1 | User-Agent: [curl/7.54.0]
wiremock-server_1 | Host: [api.coinranking.com]
wiremock-server_1 |
wiremock-server_1 |
wiremock-server_1 |
wiremock-server_1 | Matched response definition:
wiremock-server_1 | {
wiremock-server_1 | "status" : 200,
wiremock-server_1 | "proxyBaseUrl" : "http://haproxy:3128"
wiremock-server_1 | }
wiremock-server_1 |
wiremock-server_1 | Response:
wiremock-server_1 | HTTP/1.1 200
wiremock-server_1 | content-type: [application/json; charset=utf-8]
wiremock-server_1 | cache-control: [max-age=60]
wiremock-server_1 | date: [Thu, 23 Jul 2020 14:29:24 GMT]
wiremock-server_1 | etag: [W/"d0c-kU0R1br1Tp1LNUzi2p35SAjZcx8"]
wiremock-server_1 | x-rate-score: [7.272ms]
wiremock-server_1 | vary: [Accept-Encoding]
wiremock-server_1 | x-cache: [Miss from cloudfront]
wiremock-server_1 | via: [1.1 be9e8198c11c3aefc38245bb41391566.cloudfront.net (CloudFront)]
wiremock-server_1 | x-amz-cf-pop: [ORD52-C1]
wiremock-server_1 | x-amz-cf-id: [1Lyp4dpTac_iy_XD4Md-XORflT0ol74awoeUi3Ra6n8s09qndjUOnw==]
wiremock-server_1 |
wiremock-server_1 |
haproxy_1 | 00000080:be.srvrep[0015:0016]: HTTP/1.1 200 OK
haproxy_1 | 00000080:be.srvhdr[0015:0016]: content-type: application/json; charset=utf-8
haproxy_1 | 00000080:be.srvhdr[0015:0016]: content-length: 3164
haproxy_1 | 00000080:be.srvhdr[0015:0016]: access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-Access-Token
haproxy_1 | 00000080:be.srvhdr[0015:0016]: access-control-allow-methods: GET, POST, OPTIONS, PATCH, DELETE
haproxy_1 | 00000080:be.srvhdr[0015:0016]: access-control-allow-origin: *
haproxy_1 | 00000080:be.srvhdr[0015:0016]: cache-control: max-age=60
haproxy_1 | 00000080:be.srvhdr[0015:0016]: date: Thu, 23 Jul 2020 14:29:24 GMT
haproxy_1 | 00000080:be.srvhdr[0015:0016]: etag: W/"c5c-oLLEaEgPulUU74e8cMg03qEUvA8"
haproxy_1 | 00000080:be.srvhdr[0015:0016]: x-rate-score: 9.754ms
haproxy_1 | 00000080:be.srvhdr[0015:0016]: vary: Accept-Encoding
haproxy_1 | 00000080:be.srvhdr[0015:0016]: x-cache: Miss from cloudfront
haproxy_1 | 00000080:be.srvhdr[0015:0016]: via: 1.1 7b891ba5ffaf08dd209adf67026190db.cloudfront.net (CloudFront)
haproxy_1 | 00000080:be.srvhdr[0015:0016]: x-amz-cf-pop: ORD52-C1
haproxy_1 | 00000080:be.srvhdr[0015:0016]: x-amz-cf-id: kwhwDtaFfB_Do6miclqWtXwwf9Zk675psi5iFhWQSI2nxZFGE6ZUZQ==
haproxy_1 | 00000080:be.srvcls[0015:0016]
haproxy_1 | 00000080:be.clicls[0015:0016]
haproxy_1 | 00000080:be.closed[0015:0016]
haproxy_1 | <134>Jul 23 14:29:21 haproxy[6]: ::ffff:192.168.16.3:49104 [23/Jul/2020:14:29:19.041] fe be/clear 2006/0/307/236/2549 200 3792 - - ---- 2/2/0/0/0 0/0 {13.249.94.18} "GET /v1/public/coin/10 HTTP/1.1"
haproxy_1 | 00000083:fe.accept(0006)=0015 from [::ffff:192.168.16.3:49104] ALPN=<none>
haproxy_1 | 00000083:fe.clicls[0015:ffffffff]
haproxy_1 | 00000083:fe.closed[0015:ffffffff]
haproxy_1 | 00000084:fe.accept(0006)=0014 from [::ffff:192.168.16.3:49112] ALPN=<none>
wiremock-server_1 | 2020-07-23 14:29:21.593 Request received:
wiremock-server_1 | 192.168.16.1 - GET /v1/public/coin/10
wiremock-server_1 |
wiremock-server_1 | Accept: [*/*]
wiremock-server_1 | User-Agent: [curl/7.54.0]
wiremock-server_1 | Host: [api.coinranking.com]
wiremock-server_1 |
wiremock-server_1 |
wiremock-server_1 |
wiremock-server_1 | Matched response definition:
wiremock-server_1 | {
wiremock-server_1 | "status" : 200,
wiremock-server_1 | "proxyBaseUrl" : "http://haproxy:3128"
wiremock-server_1 | }
wiremock-server_1 |
wiremock-server_1 | Response:
wiremock-server_1 | HTTP/1.1 200
wiremock-server_1 | content-type: [application/json; charset=utf-8]
wiremock-server_1 | cache-control: [max-age=60]
wiremock-server_1 | date: [Thu, 23 Jul 2020 14:29:24 GMT]
wiremock-server_1 | etag: [W/"c5c-oLLEaEgPulUU74e8cMg03qEUvA8"]
wiremock-server_1 | x-rate-score: [9.754ms]
wiremock-server_1 | vary: [Accept-Encoding]
wiremock-server_1 | x-cache: [Miss from cloudfront]
wiremock-server_1 | via: [1.1 7b891ba5ffaf08dd209adf67026190db.cloudfront.net (CloudFront)]
wiremock-server_1 | x-amz-cf-pop: [ORD52-C1]
wiremock-server_1 | x-amz-cf-id: [kwhwDtaFfB_Do6miclqWtXwwf9Zk675psi5iFhWQSI2nxZFGE6ZUZQ==]
wiremock-server_1 |
wiremock-server_1 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Parallel (proxy) request and take the fastest result
I want to kind kill the parallel requests logic (preferably in a clean way) once the fastest response answers. My app is running...
Read more >Two ASA in Parallel to each other while proxy arp is enabled?
I am setting up a small network, like below. Two ASA firewalls are setup in Parallel to each other, one provides Anyconnect VPN...
Read more >A lots of requests sent into the same synchronous interface at ...
Hi guys, 1, do you have any experience with the situation when there are multiple (circa 200) requests sent to PI web service...
Read more >Proxy: Web & Concurrency
Step 1: Implement a sequen+al web proxy. □ Step 2: Make it concurrent. □ Step 3: …*. □ Step 4: PROFIT. * Cache...
Read more >Life of a Request — envoy 1.25.0-dev-843308 documentation
Egress listeners take requests from the local application and forward them to other nodes in the network. These receiving nodes will also be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In any case, I’ll raise the default value much higher in the next release so it’s not necessary to set it via the CLI.
Fixed in 38ffed9d05d920e6f8cdae6c908c609a94692045