Re: Delaying requests with Lua

2015-06-22 Thread bjun...@gmail.com
Hi, i got it working (with "math.random"). I can confirm this is non-blocking with concurrent requests. Thanks Thierry :) Full working example: haproxy.cfg: - global lua-load /etc/haproxy/delay.lua defaults mode http timeout connect 10s timeout client 10s timeout server 10

Re: Delaying requests with Lua

2015-06-18 Thread PiBa-NL
Ok i didn't realize the msleep to be coming from haproxy itself the 'core.' should have made me think twice before sending that mail. Thanks for clearing it up, of course still actual results from Bjoern will be interesting to hear a well :). Thierry schreef op 18-6-2015 om 21:12: On Thu, 18 J

Re: Delaying requests with Lua

2015-06-18 Thread Thierry
On Thu, 18 Jun 2015 20:27:07 +0200 PiBa-NL wrote: > Thing to check, what happens to concurrent connection requests? > My guess is with 10 concurrent requests it might take up to 20 > seconds(worst case for 10 connections) for some requests instead of the > expected max 2.. Note that we don't u

Re: Delaying requests with Lua

2015-06-18 Thread PiBa-NL
Thing to check, what happens to concurrent connection requests? My guess is with 10 concurrent requests it might take up to 20 seconds(worst case for 10 connections) for some requests instead of the expected max 2.. Thierry FOURNIER schreef op 18-6-2015 om 19:35: Hi, You can do this with Lua

Re: Delaying requests with Lua

2015-06-18 Thread Thierry FOURNIER
Hi, You can do this with Lua. Its very easy. First, you create a lua file containing the following code. The name of this Lua file is "file.lua". function delay_request(txn) core.msleep(1000 + txn.f.rand(1000)) end Second, you configura haproxy for loading ths file. In the global se