Hi,

We are doing about 10K requests/minute on a single haproxy server, we have
enough CPUs and memory. Right now each requests looks up a map for backend
info. It works well.

Now we  need to build some expire logic around the map. Like ignore some
entries in the map entries after some time. I could do this in lua, but it
woud mean that every request would make a lua call to look up a map value
and make a decision.

My lua method looks like this:

function get_proxy_from_map(txn)
    local host = txn.http:req_get_headers()["host"][0]
    local value = proxy_map_v2:lookup(host)
    if value then
        local values = split(value, ",")
        local proxy = values[1]
        local time = values[2]
        if os.time() > tonumber(time) then
            core.Alert("Expired: returning nil: " .. host)
            return
        else
            return proxy
        end
    end
    return
end


Any suggestions on how this would impact performance, our tests looks ok.

Thanks
Sachin

Reply via email to