Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add set_peer_weight api #5

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

rockiee281
Copy link

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

@agentzh
Copy link
Member

agentzh commented Oct 16, 2014

@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
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
Copy link
Member

agentzh commented Oct 20, 2014

@rockiee281 It already comes with a test suite:

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

@rockiee281
Copy link
Author

@agentzh add some test case for this feature

@agentzh
Copy link
Member

agentzh commented Oct 28, 2014

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

@jamespan
Copy link

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

@agentzh
Copy link
Member

agentzh commented Nov 28, 2015

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

@jamespan
Copy link

@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
Copy link
Member

agentzh commented Nov 28, 2015

@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

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

pfischermx pushed a commit to pfischermx/lua-upstream-nginx-module that referenced this pull request May 9, 2018
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