Deploy nodejs server on reverse proxy nginx is slow
SudoDios opened this issue · 3 comments
SudoDios commented
I create a nodejs http server and using autocannon to loadtest.
When I use this node server without a nginx proxy, the requests reach 137k per second.
But when I use it with nginx reverse proxy, it reaches 60k per second.
Why ????
please help me.🙏
jarebear6expepjozn6rakjq5iczi3irqwphcvb commented
Can you post config for the reverse proxy?
SudoDios commented
user www-data;
worker_processes auto;
worker_rlimit_nofile 900000;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 400000;
use epoll;
multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
#types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_min_length 10240;
gzip_comp_level 1;
gzip_vary on;
gzip_disable msie6;
gzip_proxied expired no-cache no-store private auth;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
access_log off;
auth_basic "Auth ...";
auth_basic_user_file /etc/nginx/.htpasswd;
server {
listen myIP:80;
client_max_body_size 1g;
location / {
root /home/sudodios/banoo;
}
location /api/ {
proxy_pass http://localhost:2000/;
}
}
}
http://localhost:2000/ is my node server.