Skip to content

add set_peer_weight api#5

Open
rockiee281 wants to merge 6 commits into
openresty:masterfrom
rockiee281:master
Open

add set_peer_weight api#5
rockiee281 wants to merge 6 commits into
openresty:masterfrom
rockiee281:master

Conversation

@rockiee281

Copy link
Copy Markdown

add new api for upstream module for #4 , change backen weight dynamic

@agentzh

agentzh commented Oct 16, 2014

Copy link
Copy Markdown
Member

@rockiee281 Thank you for looking into this! Several comments though:

  1. I think you need to (at least) update peers->total_weight, peers->weighted, and peer->current_weight fields accordingly as well.
  2. I don't see any tests for it. Will you add some corresponding test cases to the existing test suite?

Thanks!

@rockiee281

Copy link
Copy Markdown
Author

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?

@agentzh

agentzh commented Oct 20, 2014

Copy link
Copy Markdown
Member

@rockiee281 It already comes with a test suite:

https://github.com/openresty/lua-upstream-nginx-module/tree/master/t

@rockiee281

Copy link
Copy Markdown
Author

@agentzh add some test case for this feature

@agentzh

agentzh commented Oct 28, 2014

Copy link
Copy Markdown
Member

@rockiee281 Thank you very much! I'll look into this as soon as I can manage :)

@jamespan

Copy link
Copy Markdown

There's an implement here😂 I just made an implement myself these days

@agentzh

agentzh commented Nov 28, 2015

Copy link
Copy Markdown
Member

I remember there was already a PR for this feature. Check the pull request list of this repos?

@jamespan

Copy link
Copy Markdown

@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.

@agentzh

agentzh commented Nov 28, 2015

Copy link
Copy Markdown
Member

@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.

@pfischermx

Copy link
Copy Markdown

It's been almost 3 years. What are folks doing to change weights via lua? Or is there a better way/module to that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants