pls. help for adding another parameter to ngx_upstream_server

Maxim Dounin mdounin at mdounin.ru
Tue Nov 26 13:29:09 UTC 2013


Hello!

On Tue, Nov 26, 2013 at 06:37:59PM +0900, moto kawasaki wrote:

> 
> Hello,
> 
> I am the questioner about setfib feature on the upstream side.
> And I am back for asking you comments/suggestions/help.
> Thank you very much in advance.
> 
> Please refer the following URL for the conversation before.
> http://forum.nginx.org/read.php?29,244686 
> 
> mdounin> Well, as far as I can tell there is no reasons to do per-server 
> mdounin> setfib in this usecase, and 
> mdounin> 
> mdounin>     proxy_setfib N;
> mdounin> 
> mdounin> should be enough.  It should be much easier to implement than what 
> mdounin> you are trying to do in your patch.
> 
> Thank you very much, Mr. Dounin, I followed your advice.
> 
> Now, I am refering src/http/modules/ngx_http_upstream_keepalive_module.c, 
> and create a new module "ngx_http_upstream_proxy_setfib_module.c".
> 
> With this module, I can write "setfib N" in nginx.conf like;
> 
>   http {
>         (snip)
>         upstream UPSTREAM {
>                 proxy_setfib 5;
>                 server 10.200.195.70:80 max_fails=3 fail_timeout=300;
>         }
>   }
> 
> And also I can create server config for this module, and the config
> "proxy_setfib 5" can be read and set into server config.

Why you are trying to do this with a balancer module?  You won't 
be able to do this with a balancer module anyway, as you'll have 
to call setsockopt() on a socket after it's created but before the 
connect() is called, which is only possible with modifications to 
ngx_event_connect_peer().

Try following proxy_bind implementation as already suggested.

[...]

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx-devel mailing list