SSIA
64bit環境だと9223372036854775807
` まで設定できる
それ以上だとエラーがでる
nginxのweight
nginxをlbとして扱うときにweightを指定して流すリクエストの重みを設定できる
↓以下のように
```bash
upstream backend {
server server1:80 weight=2;
server server2:80 weight=1;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass <http://backend>;
}
}
その値はconfで設定した後、nginxのここで呼ばれる
[nginx/nginx](<https://github.com/nginx/nginx/blob/5eadaf69e394c030056e4190d86dae0262f8617c/src/http/ngx_http_upstream.c#L5946-L5950>)
上限は設定されていないがソースコードを読むと `NGX_MAX_INT_T_VALUE` がある
64bit環境だとintの最大値の `9223372036854775807`
[nginx/nginx](<https://github.com/nginx/nginx/blob/6029e211c63895c44a942bacc32c6d2f565cc3e3/src/core/ngx_string.c#L967-L991>)
[nginx/nginx](<https://github.com/nginx/nginx/blob/a64190933e06758d50eea926e6a55974645096fd/src/core/ngx_config.h#L86-L93>)
手元のmacbookで64bit intの最大値を超えた値を入れて試してみる
```bash
upstream backend {
server server1:80 weight=9223372036854775810;
server server2:80 weight=1;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass <http://backend>;
}
}
試すとエラーが起こるのが確認できる
lb_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
lb_1 | /docker-entrypoint.sh: Configuration complete; ready for start up
lb_1 | 2021/06/13 07:43:46 [emerg] 1#1: invalid parameter "weight=9223372036854775810" in /etc/nginx/conf.d/default.conf:2
lb_1 | nginx: [emerg] invalid parameter "weight=9223372036854775810" in /etc/nginx/conf.d/default.conf:2