Kaynağa Gözat

Add keepalive on worker upstreams and use HTTP 1.1 for persistent connections

pull/3076/head
Charles Wright 2 yıl önce
ebeveyn
işleme
c053336ad2
1 değiştirilmiş dosya ile 4 ekleme ve 0 silme
  1. +4
    -0
      roles/custom/matrix-synapse-reverse-proxy-companion/templates/nginx/conf.d/matrix-synapse-reverse-proxy-companion.conf.j2

+ 4
- 0
roles/custom/matrix-synapse-reverse-proxy-companion/templates/nginx/conf.d/matrix-synapse-reverse-proxy-companion.conf.j2 Dosyayı Görüntüle

@@ -12,6 +12,7 @@
{% macro render_worker_upstream(name, workers) %} {% macro render_worker_upstream(name, workers) %}
{% if workers | length > 0 %} {% if workers | length > 0 %}
upstream {{ name }} { upstream {{ name }} {
keepalive {{ workers | length * 2 }};
{% for worker in workers %} {% for worker in workers %}
server "{{ worker.name }}:{{ worker.port }}"; server "{{ worker.name }}:{{ worker.port }}";
{% endfor %} {% endfor %}
@@ -24,6 +25,8 @@
location ~ {{ location }} { location ~ {{ location }} {
proxy_pass http://{{ upstream_name }}$request_uri; proxy_pass http://{{ upstream_name }}$request_uri;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
} }
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
@@ -39,6 +42,7 @@
# ensures that requests from the same client will always be passed # ensures that requests from the same client will always be passed
# to the same server (except when this server is unavailable) # to the same server (except when this server is unavailable)
hash $http_x_forwarded_for; hash $http_x_forwarded_for;
keepalive {{ generic_workers | length * 2 }};


{% for worker in generic_workers %} {% for worker in generic_workers %}
server "{{ worker.name }}:{{ worker.port }}"; server "{{ worker.name }}:{{ worker.port }}";


Yükleniyor…
İptal
Kaydet