lua-upstream-nginx-module
lua-upstream-nginx-module copied to clipboard
add set_peer_weight api
add new api for upstream module for #4 , change backen weight dynamic
@rockiee281 Thank you for looking into this! Several comments though:
- I think you need to (at least) update
peers->total_weight
,peers->weighted
, andpeer->current_weight
fields accordingly as well. - I don't see any tests for it. Will you add some corresponding test cases to the existing test suite?
Thanks!
Hi, @agentzh ,add some commits to update peers->total_weight
, peers->weighted
and peer->current_weight
, wish it works because I'm not so familar with nginx and C.
I'll try to add some test case later. But I cannot find any example in this project, where can I find them?
@rockiee281 It already comes with a test suite:
https://github.com/openresty/lua-upstream-nginx-module/tree/master/t
@agentzh add some test case for this feature
@rockiee281 Thank you very much! I'll look into this as soon as I can manage :)
There's an implement here😂 I just made an implement myself these days
I remember there was already a PR for this feature. Check the pull request list of this repos?
@agentzh we are talking under that PR right now. My newly post mention the functions I added to the lua upstream module. Take a look if you like.
http://blog.jamespan.me/2015/11/27/fastest-first-load-balancer-for-nginx-with-lua/
I use three functions to update weight, current weight, and effective weight respectively.
So I wander if I need to finish the test suit and push another PR.
@JamesPan Thanks for the efforts. I will have a closer look at your PR later. Currently busy with the PRs implementing the ngx.semaphore
API in ngx_lua.
It's been almost 3 years. What are folks doing to change weights via lua? Or is there a better way/module to that?