Nginx e NodeJs servindo arquivos estáticos lentos

1

EutenhoumpequenoaplicativoNodeJS,comumfrontNginxparaservirosarquivosestáticosparaaumentarodesempenho.

Oarquivobundle.jslevaemtornode1ssemcarga,noentanto,adicionaalgunsusuáriossimultâneoseobundle.jsrecebeosucesso!

Issoestásendoexecutadoemk8s,maséumambientenovinhoemfolha,portantonãodevehaveroutrasinfluências.

ACPUnãoaumenta,amemóriaestánomenoruso,eeutenteitodosostruquescomunsdosend_file-existealgumamaneiraqueeupossaobteralgumrendimentoaqui?

default.conf

server{listen80;root/mnt/app;indexindex.htmlindex.htm;location~*\.(jpg|jpeg|png|gif|ico|css|js)${expires365d;}access_logoff;open_file_cachemax=2000inactive=3600s;open_file_cache_valid3600s;open_file_cache_min_uses1;open_file_cache_errorsoff;location/public/{try_files$uri$uri/=404;}location/Healthcheck/{proxy_passhttp://localhost:8080;}location/auth/login/{proxy_passhttp://localhost:8080;}location/auth/connect/{proxy_passhttp://localhost:8080;}location/data/{proxy_passhttp://localhost:8080;}}

link

usernginx;worker_processes1;error_log/var/log/nginx/error.logwarn;connect-frontend-nginxpid/var/run/nginx.pid;events{worker_connections1024;}http{include/etc/nginx/mime.types;default_typeapplication/octet-stream;log_formatmain'$remote_addr-$remote_user[$time_local]"$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    sendfile_max_chunk 512;
    # server_tokens off;

    keepalive_timeout  65;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

gzip.conf

## Compression.
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 1;
gzip_http_version 1.1;
gzip_min_length 10;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/x-icon application/vnd.ms-fontobject font/opentype application/x-font-ttf;
gzip_vary on;
gzip_proxied any; # Compression for all requests.
## No need for regexps. See
## http://wiki.nginx.org/NginxHttpGzipModule#gzip_disable
gzip_disable msie6;

## Serve already compressed files directly, bypassing on-the-fly
## compression.
##
# Usually you don't make much use of this. It's better to just
# enable gzip_static on the locations you need it.
# gzip_static on;

Como por @ comentários de Tim - saída CURL:

My Machine

10.244.0.1 - - [07/Jun/2018:08:15:45 +0000] "GET /Public/JS/Auth/bundle.js HTTP/1.1" 200 1007996 "http://51.144.234.135/auth/login/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36" request-time: 0.579 Upstream-time: - .

CURL localhost

127.0.0.1 - - [06/Jun/2018:15:04:37 +0000] "GET /Public/JS/Auth/bundle.js HTTP/1.1" 200 3081261 "-" "curl/7.60.0" "-"

CURL to IP - From host

10.244.0.1 - - [06/Jun/2018:15:04:57 +0000] "GET /Public/JS/Auth/bundle.js HTTP/1.1" 200 3081261 "-" "curl/7.60.0" "-"
    
por Stuart.Sklinar 05.06.2018 / 18:13

0 respostas