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

adding a max_fails parameter to upstream member[s] #675

Merged
merged 1 commit into from
Sep 8, 2015
Merged

adding a max_fails parameter to upstream member[s] #675

merged 1 commit into from
Sep 8, 2015

Conversation

ghost
Copy link

@ghost ghost commented Sep 1, 2015

As defined in nginx upstream documentation: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream

I added this optional parameter because we folks have to deal with a finicky backend that randomly timeout on a single request when under heavy load. When this happens, the upstream gets disabled for 10 seconds (fail_timeout) and for that period of time other upstreams receive the requests which doesn't play nice with our application.

Increasing this parameter to max_fails=3 ensures that load is switched only when really necessary.

  nginx::resource::upstream { $upstream_name:
    ensure               => present,
    members              => $upstream_servers,
    upstream_cfg_prepend => {
      'ip_hash'   => '',
      'keepalive' => '128',
    },
    upstream_max_fails   => 3,
  }

becomes s:

upstream backend {

  ip_hash ;

  keepalive 65;

  server     server1.domain  fail_timeout=10s max_fails=3;
  server     server2.domain  fail_timeout=10s max_fails=3;
}

Let me know if I should change anything, thanks

@jfryman
Copy link
Contributor

jfryman commented Sep 8, 2015

Great! Thanks for the code!

@jfryman jfryman closed this Sep 8, 2015
@jfryman jfryman reopened this Sep 8, 2015
jfryman added a commit that referenced this pull request Sep 8, 2015
adding a max_fails parameter to upstream member[s]
@jfryman jfryman merged commit d4d55c3 into voxpupuli:master Sep 8, 2015
Slm0n87 pushed a commit to Slm0n87/puppet-nginx that referenced this pull request Mar 7, 2019
adding a max_fails parameter to upstream member[s]
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.

1 participant