Hi, again.
Actually, when I think more about it, this service needs to support SSL, so a 
Layer 7 implementation is needed.Also, when I put the TCP applet under any 
degree of stress (as little as 100 request with concurrency 10), it hangs? The 
other two implementations (http-req vs http applet) seem to behave very 
similarly to each other, though. 
Increasing the number of processes (nbproc 2) makes a difference. At 
concurrency 1000 and 30000 requests, the 90% response time rises to 2-3ms, but 
there is typically no 200ms spike on the last few requests; they take only 
10-15ms.

    On Thursday, 12 November 2015, 5:50, PiBa-NL <piba.nl....@gmail.com> wrote:
 

  Hi Thrawn,
 
 I tried these configs, and there doesn't seem to be much if any difference. 
The tcp one might even be the slowest in my limited virtualized tests, but only 
my a few milliseconds..
 
 frontend lua-replyip
     bind            192.168.0.120:9010   
     mode            http
     http-request use-service lua.lua-replyip 
 frontend lua-replyip-copy
     bind            192.168.0.120:9011  
     mode            tcp
     tcp-request content use-service lua.lua-replyip-tcp 
 frontend lua-replyip-httpreq
     bind            192.168.0.120:9012   
     mode            http
     http-request lua.lua-replyip-http-req 
 
 core.register_service("lua-replyip", "http", function(applet) 
    local response = applet.f:src()
    applet:set_status(200)
    applet:add_header("Server", "haproxy-lua/echo") 
    applet:add_header("content-length", string.len(response)) 
    applet:add_header("content-type", "text/plain") 
    applet:start_response() 
    applet:send(response) 
 end)
 
 core.register_service("lua-replyip-tcp", "tcp", function(applet)
    local buffer = applet.f:src()
    applet:send("HTTP/1.0 200 OK\r\nServer: haproxy-lua/echo\r\nContent-Type: 
text/html\r\nContent-Length: " .. buffer:len() .. "\r\nConnection: 
close\r\n\r\n" .. buffer)
 end)
 
 core.register_action("lua-replyip-http-req", { "http-req" }, function (txn)
     local buffer = txn.f:src()
     txn.res:send("HTTP/1.0 200 OK\r\nServer: haproxy-lua/echo\r\nContent-Type: 
text/html\r\nContent-Length: " .. buffer:len() .. "\r\nConnection: 
close\r\n\r\n" .. buffer)
     txn:done()
 end)
  

Reply via email to