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. 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
section:

    lua-load file.lua

In your frontend (or backend)

    http-request lua delay_request if { ... your condition ... }

Note that I didn't test this configuration, I'm just giving the main
lines. Please share your results, it's maybe interesting for everyone.

Thierry



On Thu, 18 Jun 2015 17:55:31 +0200
"bjun...@gmail.com" <bjun...@gmail.com> wrote:

Hi,

i want to delay specific requests and i want to have a random delay
for every request (for example in a range from 1000ms - 2000ms)


As an ugly hack, you can use the following (with a static value):


  tcp-request inspect-delay 2000ms
  tcp-request content accept if WAIT_END


I think i can achieve random delays with Lua. Does anyone have a
example how this can be realized with Lua ?



Thanks in advance !



-----------
Bjoern



Reply via email to