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

[機能提案] upstream のオプションを指定できる機能 #29

Open
lobin-z0x50 opened this issue Apr 2, 2024 · 1 comment
Open

Comments

@lobin-z0x50
Copy link
Member

#25 より

nginx では upstream の指定に max_conns keepalive などのオプションが指定できる。
それをDSLで指定可能にしたい。

構文の例:

donain() {
  proxy_to 'rails:3000', max_conns: 100, keepalive: 90
}

出力結果:

upstream example {
    server rails:3000 max_conns=100;
    keepalive 90;
}

参考: https://serverfault.com/questions/1079180/nginx-max-conns-limit-on-multiple-servers

https://stackoverflow.com/questions/37879337/nginx-limit-the-number-of-connections-to-an-upstream-server

upstreamごとにオプションを変えられるよう、proxy_to を複数してしたり、 文字列中にカンマ区切りでオプション指定できるような書式も検討したい。

# 複数指定するパターン
domain() {
  proxy_to 'rails-main:3000', max_conns: 10
  proxy_to 'rails-sub:3000', max_conns: 5
}

# 文字列中にカンマ区切りで指定するパターン
domain() {
  proxy_to 'rails-main:3000,max_conns:10', 'rails-sub:3000,max_conns:5'
}
@lobin-z0x50
Copy link
Member Author

listen に対するオプションは、 #44 で実装済み。
この issue では upstream 側に対するオプションの話題となっている。

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

No branches or pull requests

1 participant