로컬환경에서 부하를 분산할 수 있는지 테스트 해보기 위해 윈도우에 nginx를 설치하고 부하테스트를 진행해보려고 했습니다.
localhost:80포트로 접속하니 예전에 깔았던 아파치서버가 80번포트를 차지하고 있는거 같아서 80번 포트 사용권한을 nginx에게 넘기려고 했으나 실패해서 8001번 포트로 설정하여 테스트를 진행하려고 했습니다
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8001;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
localhost:8001번으로 접속했을때 아래 에러가 발생하여 에러해결을 시도 해봤지만 해결하지 못해서 로컬환경에서 트래픽 분산 모의 테스트는 진행해보지 못했습니다.
질문사항
1. 실제 서버에 부하테스트 어떻게 실행
배포서버 주소로 부하테스트를 실행했을때 실제 요청이 가기때문에 서버와 같은 환경이 구축된 가짜서버로 요청을 보내야하는걸로 알고있습니다. 가짜서버를 어떤방식으로 구축해야 하는지 감이 조금 오지 않아서 질문드립니다. aws lamda라는 서비스를 이용해야 하는건지 질문드립니다!
2. nginx로 트래픽분산
ngixn로 리버스 프록시 서버를 구현했을때 일반적으로 3개의 포트를 열어 트래픽을 분산시키는 방식으로 알고있습니다.
예를들어 3000,3001,3002번 포트를 개방한다는 뜻은 서버를 3개를 실행한다라는 의미로 알고있습니다. 서버를 3개 실행했을때 같은 컴퓨터에서 모든 요청을 처리하지만 3개의 서버를 실행하면 각각 프로세스가 실행되기 때문에 1개의 서버를 실행하여 1개의 프로세스를 실행했을때보다 요청을 빠르게 처리할 수 있다라고 이해하고 있는데 제가 이해하고 있는 부분중에 잘못된 부분이 있는지 여쭤보고 싶습니다
질문드린 이유는 어제 다른 조원분과 얘기하다가 포트를 1개를 열어서 실행하는 것과 3개를 열어서 실행하는 것은 크게 차이가 없다라는 얘기가 나와서 질문드립니다