Hello,
I am a CS student and I am trying to learn HAproxy and Lua API.
I want to load web server pages faster than before. Is it possible with
HAproxy Lua API ? If it is possible , which algorithm I should use ?
my getbackend.cfg
global
daemon
log /dev/log local0
log /dev/log local1 notice
maxconn 50000
lua-load /etc/haproxy/getbackend.lua
defaults
log global
retries 3
backlog 10000
maxconn 10000
timeout connect 3s
timeout client 30s
timeout server 30s
timeout tunnel 3600s
timeout http-keep-alive 1s
timeout http-request 15s
timeout queue 30s
timeout tarpit 60s
option redispatch
option http-server-close
option dontlognull
frontend mywebserver
bind *:8080
mode http
use_backend %[lua.choose_backend]
backend backend1
balance roundrobin
mode http
server ws1 192.168.122.232:8080
server ws3 192.168.122.219:8080
backend backend2
balance roundrobin
mode http
server ws2 192.168.122.72:8080
server ws4 192.168.122.172:8080
and my getbackend.lua
core.register_fetches("choose_backend", function(txn)
if txn.sf:req_fhdr("host") == 'test.com:8080' then
return "backend1"
elseif txn.sf:req_fhdr("host") == 'example.com:8080' then
return "backend2"
end
end)
King Regards,
Burak
--
*Burak Çayır*
*539 578 3671*
*burakcayir.net <http://burakcayir.net>*
*Ankara - Türkiye*