JMETER creates multiple process threads even for Single Thread run - concurrency

I am running a simple JMETER file with one Thread Group with Single user.
when I look at the background ps -eL | grep jmeter
I get more than 30+ threads for that PID as below.
Any suggestion why this is occuring and if there is a way to prevent this?
output of ps -eL | grep jmeter
6380 6380 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6381 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6382 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6383 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6384 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6385 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6386 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6387 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6388 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6389 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6390 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6391 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6392 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6393 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6394 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6395 pts/0 Rl+ 0:02 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6396 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6397 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6398 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6399 pts/0 Sl+ 0:03 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6402 pts/0 Sl+ 0:02 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6403 pts/0 Sl+ 0:02 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6404 pts/0 Sl+ 0:02 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6405 pts/0 Sl+ 0:03 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6406 pts/0 Sl+ 0:02 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6407 pts/0 Sl+ 0:02 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6408 pts/0 Sl+ 0:03 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6409 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6410 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6411 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6412 pts/0 Sl+ 0:01 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6413 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6414 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6415 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6416 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6417 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6419 pts/0 Sl+ 1:34 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6420 pts/0 Sl+ 1:05 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx
6380 6421 pts/0 Sl+ 0:00 /usr/bin/java -jar /home/manh/inhouse_apps/jmeter/apache-jmeter-5.3/bin/ApacheJMeter.jar -n -t jmx/retail/dev/test_concurrency.jmx

One JMeter instance = one Java process, the number of internal threads can be viewed using i.e. JConsole
If you're seeing more than one Java process it means that you (or someone else) started another JMeter instance in non-GUI mode
You might also want to consider upgrading to the latest JMeter version (which is JMeter 5.4.1 as of now) as you're supposed to be using the latest version of JMeter according to Best Practices user manual chapter

Related

How to deploy fastapi app to EC2 with docker-compose.yaml and dockerized nginx server

Trying to switch to using docker-compose to deploy the application on EC2. At the same time, I want nginx to be deployed in docker image as well.
Dockerfile
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
docker-compose.yaml
version: '3.9'
services:
web:
env_file: .env
build: .
command: sh -c "alembic upgrade head && uvicorn main:app --host 0.0.0.0 --port 8000"
volumes:
- .:/app
ports:
- 8000:8000
depends_on:
- db
- redis
db:
image: postgres:11
volumes:
- postgres_data:/var/lib/postgresql/data
expose:
- 5432
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASS}
- POSTGRES_DB=${DB_NAME}
redis:
image: redis:6-alpine
volumes:
- redis_data:/data
nginx:
image: nginx:latest
ports:
- "8080:8080"
volumes:
- ./nginx_config.conf:/etc/nginx/conf.d/default.conf
depends_on:
- web
volumes:
postgres_data:
redis_data:
nginx_config.conf
server {
listen 8080;
server_name 3.70.228.88;
location /static/ {
root /app;
try_files $uri $uri/ =404;
}
location / {
proxy_pass http://web:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Runing sudo docker-compose up. No any errors, looks good
ubuntu#ip-172-31-24-232:~/wplay$ sudo docker-compose up
Starting wplay_redis_1 ... done
Starting wplay_db_1 ... done
Starting wplay_web_1 ... done
Starting wplay_nginx_1 ... done
Attaching to wplay_redis_1, wplay_db_1, wplay_web_1, wplay_nginx_1
db_1 |
db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1 |
db_1 | 2023-01-10 14:18:04.378 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2023-01-10 14:18:04.378 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2023-01-10 14:18:04.384 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2023-01-10 14:18:04.417 UTC [24] LOG: database system was shut down at 2023-01-07 10:52:36 UTC
db_1 | 2023-01-10 14:18:04.451 UTC [1] LOG: database system is ready to accept connections
redis_1 | 1:C 10 Jan 2023 14:18:04.034 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 10 Jan 2023 14:18:04.034 # Redis version=6.2.8, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 10 Jan 2023 14:18:04.034 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | 1:M 10 Jan 2023 14:18:04.034 * monotonic clock: POSIX clock_gettime
redis_1 | 1:M 10 Jan 2023 14:18:04.037 * Running mode=standalone, port=6379.
redis_1 | 1:M 10 Jan 2023 14:18:04.038 # Server initialized
redis_1 | 1:M 10 Jan 2023 14:18:04.038 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 10 Jan 2023 14:18:04.039 * Loading RDB produced by version 6.2.8
redis_1 | 1:M 10 Jan 2023 14:18:04.039 * RDB age 271528 seconds
redis_1 | 1:M 10 Jan 2023 14:18:04.039 * RDB memory usage when created 0.77 Mb
redis_1 | 1:M 10 Jan 2023 14:18:04.039 # Done loading RDB, keys loaded: 0, keys expired: 0.
redis_1 | 1:M 10 Jan 2023 14:18:04.039 * DB loaded from disk: 0.001 seconds
redis_1 | 1:M 10 Jan 2023 14:18:04.039 * Ready to accept connections
nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
nginx_1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
nginx_1 | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
nginx_1 | /docker-entrypoint.sh: Configuration complete; ready for start up
nginx_1 | 2023/01/10 14:18:05 [notice] 1#1: using the "epoll" event method
nginx_1 | 2023/01/10 14:18:05 [notice] 1#1: nginx/1.23.3
nginx_1 | 2023/01/10 14:18:05 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
nginx_1 | 2023/01/10 14:18:05 [notice] 1#1: OS: Linux 5.15.0-1026-aws
nginx_1 | 2023/01/10 14:18:05 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
nginx_1 | 2023/01/10 14:18:05 [notice] 1#1: start worker processes
nginx_1 | 2023/01/10 14:18:05 [notice] 1#1: start worker process 28
web_1 | INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
web_1 | INFO [alembic.runtime.migration] Will assume transactional DDL.
web_1 | INFO: Started server process [8]
web_1 | INFO: Waiting for application startup.
web_1 | INFO: Application startup complete.
web_1 | INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
But when I go to the http://<ip address> I get
This site can't be reached
What's my mistake?
upd
What about your security group ? Did you opened the HTTP port range on port 80 for example ?

How to run multiple manage.py using docker file

I have Django application which has docker file and using below command to bring up the application
CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "--worker-class", "uvicorn.workers.UvicornWorker", "myapplication.asgi:application"]
Would like to run one more process "task_process" which is present in the below directory structure
taskApp/
__init__.py
models.py
management/
__init__.py
commands/
__init__.py
task_process.py
How to execute task_process after loading an application ?
I tried the below shell script commands in startup.sh. But no luck
#!/bin/sh
exec gunicorn --bind :8000 --workers 3 --worker-class uvicorn.workers.UvicornWorker myapplication.asgi:application &
exec python manage.py task_process
#!/bin/sh
exec gunicorn --bind :8000 --workers 3 --worker-class uvicorn.workers.UvicornWorker myapplication.asgi:application &
python manage.py task_process
#!/bin/sh
gunicorn --bind :8000 --workers 3 --worker-class uvicorn.workers.UvicornWorker myapplication.asgi:application &
python manage.py task_process
#!/bin/sh
gunicorn --bind :8000 --workers 3 --worker-class uvicorn.workers.UvicornWorker myapplication.asgi:application
python manage.py task_process
Updated existing Docker file as below
RUN chmod +x startup.sh
CMD ["./startup.sh"]

django.db.utils.OperationalError: attempt to write a readonly database

i'm trying to deploy my first web app.
I'm using django + docker + nginx + uwsgi. Trying to deploy firstly in my laptop.
When i'm run my web application using django server everything ok, also it looks ok when i'm trying start web app with docker without nginx, but when i'm using with nginx proxy have a problem with writing data to DB (login/logout user sessions). If i go only to read pages, web app working fine with static files and crashing during user session changes (log in/log out)
Problem with rights of my default database
issue picture
app_1 | Internal Server Error: /logout/
app_1 | Traceback (most recent call last):
app_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
app_1 | return self.cursor.execute(sql, params)
app_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 413, in execute
app_1 | return Database.Cursor.execute(self, query, params)
app_1 | sqlite3.OperationalError: attempt to write a readonly database
(venv) yhobby#hp-probook-450-g5:~/PycharmProjects/web_naas$ ls -la
total 52
drwxrwsrwx 8 www-data yhobby 4096 Nov 19 15:16 .
drwsrwsrwt 9 yhobby yhobby 4096 Nov 18 16:09 ..
drwxrwsrwx 6 www-data yhobby 4096 Nov 19 13:59 app
-rwxrwxrwx 1 yhobby yhobby 293 Nov 19 14:51 docker-compose-deploy.yml
-rwxrwxrwx 1 yhobby yhobby 202 Nov 19 11:35 docker-compose.yml
-rwxrwxrwx 1 yhobby yhobby 701 Nov 19 15:16 Dockerfile
drwxrwsr-x 8 yhobby yhobby 4096 Nov 19 09:06 .git
-rw-rw-r-- 1 yhobby yhobby 100 Nov 19 08:40 .gitignore
drwxrwsr-x 3 yhobby yhobby 4096 Nov 19 15:28 .idea
drwxrwsrwx 2 yhobby yhobby 4096 Nov 19 15:11 proxy
-rwxrwxrwx 1 yhobby yhobby 29 Nov 18 16:09 README.md
drwxrwsrwx 2 yhobby yhobby 4096 Nov 18 18:40 scripts
drwxrwsrwx 6 yhobby yhobby 4096 Nov 18 16:13 venv
(venv) yhobby#hp-probook-450-g5:~/PycharmProjects/web_naas/app$ ls -la
total 17820
drwxrwsrwx 6 www-data yhobby 4096 Nov 19 13:59 .
drwxrwsrwx 8 www-data yhobby 4096 Nov 19 15:16 ..
drwxrwsrwx 7 yhobby yhobby 4096 Nov 19 12:13 dashboard
-rwxrwxrwx 1 yhobby yhobby 131072 Nov 19 13:59 db.sqlite3
drwxrwsrwx 8 yhobby yhobby 4096 Nov 19 08:43 .git
-rwxrwxrwx 1 yhobby yhobby 92 Nov 19 08:43 .gitignore
-rwxrwxrwx 1 yhobby yhobby 18075648 Oct 2 06:15 ip_core.db
-rwxrwxrwx 1 yhobby yhobby 660 Nov 19 08:43 manage.py
drwxrwsrwx 3 yhobby yhobby 4096 Nov 19 14:48 naas
-rwxrwxrwx 1 yhobby yhobby 29 Nov 19 08:43 README.md
-rwxrwxrwx 1 yhobby yhobby 187 Nov 19 08:43 requirements.txt
drwxrwsrwx 4 yhobby yhobby 4096 Nov 19 12:06 static
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
},
'ip_core': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'ip_core.db',
}
}
web_naas/Dockerfile # root folder web_naas/
# pull official base image
FROM python:3.8-alpine
# set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/scripts:${PATH}"
# install dependencies
COPY app/requirements.txt /requirements.txt
RUN apk add --update --no-cache --virtual .tmp gcc libc-dev linux-headers
RUN pip install -r /requirements.txt
RUN apk del .tmp
# copy directory
RUN mkdir /app
COPY ./app /app
# set work directory
WORKDIR /app
# copy directory
COPY ./scripts /scripts
RUN chmod +x /scripts/*
RUN chmod 777 /app/db.sqlite3
RUN mkdir -p /vol/web/media
RUN mkdir -p /vol/web/static
RUN adduser -D user
RUN chown -R user:user /vol
RUN chmod -R 777 /vol/web
USER user
CMD ["entrypoint.sh"]
web_naas/docker-compose.yml # root folder
version: '3.7'
services:
app:
build: .
ports:
- "8000:8000"
volumes:
- ./app:/app
command: sh -c "python manage.py runserver 0.0.0.0:8000"
environment:
- DEBUG=1
docker-compose-deploy.yml
version: '3.7'
services:
app:
build: .
volumes:
- static_data:/vol/web
environment:
- DEBUG=1
proxy:
build:
context: ./proxy
volumes:
- static_data:/vol/static
ports:
- "8080:8080"
depends_on:
- app
volumes:
static_data:
web_naas/proxy/Dockerfile
FROM nginxinc/nginx-unprivileged:1-alpine
COPY ./default.conf /etc/nginx/conf.d/default.conf
COPY ./uwsgi_params /etc/nginx/uwsgi_params
USER root
RUN mkdir -p /vol/static
RUN chmod 777 /vol/static
USER nginx
web_naas/proxy/default.conf
server {
listen 8080;
location /static {
alias /vol/static;
}
location / {
uwsgi_pass app:8000;
include /etc/nginx/uwsgi_params;
}
}
web_naas/scripts/entrypoint.sh
#!/bin/sh
set -e
python manage.py collectstatic --noinput
uwsgi --socket :8000 --master --enable-threads --module naas.wsgi
The problem was a lack of rights inside the docker container
Added the following line inside the file
web_naas/Dockerfile # root folder
RUN chown -R user:user /app

nginx server : cannot connect 128.0.0.1:8888

My error
Unable to connect
Firefox can’t establish a connection to the server at 127.0.0.1:8888.
ls -l /etc/fdfs/
total 84
-rw-r--r-- 1 root root 1469 六月 14 10:10 client.conf
-rw-r--r-- 1 root root 1461 六月 14 09:44 client.conf.sample
-rw-r--r-- 1 root root 955 六月 14 14:31 http.conf
-rw-r--r-- 1 root root 31172 六月 14 14:31 mime.types
-rw-r--r-- 1 root root 3725 六月 14 14:22 mod_fastdfs.conf
-rw-r--r-- 1 root root 7938 六月 14 10:02 storage.conf
-rw-r--r-- 1 root root 7927 六月 14 09:44 storage.conf.sample
-rw-r--r-- 1 root root 105 六月 14 09:44 storage_ids.conf.sample
-rw-r--r-- 1 root root 7394 六月 14 10:25 tracker.conf
-rw-r--r-- 1 root root 7389 六月 14 09:44 tracker.conf.sample
my server
ps aux |grep nginx
root 29867 0.0 0.0 38152 616 ? Ss 14:41 0:00 nginx: master process ./nginx
coco 30010 0.0 0.0 21532 1084 pts/2 S+ 14:55 0:00 grep --color=auto nginx
/usr/local/nginx/conf
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 8888;
server_name localhost;
location ~/group[0-9]/ {
ngx_fastdfs_module;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
I am trying to view picture that I just upload .
Command like this
fdfs_upload_file /etc/fdfs/client.conf /home/coco/Pictures/coco.jpg
group1/M00/00/00/wKgTgF7lxkyAGO0-AAAiaSlNP3Q922.jpg
I double check my tracker.conf and I find I forget change bath_path
It should be
base_path=/home/coco/fastdfs/tracker/
After change my server process like this
root 31082 0.0 0.2 141252 6804 ? Ss 15:28 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 31546 0.0 0.2 143924 6464 ? S 15:36 0:00 nginx: worker process
www-data 31547 0.0 0.2 143924 6464 ? S 15:36 0:00 nginx: worker process
root 31678 0.0 0.0 38156 616 ? Ss 15:45 0:00 nginx: master process ./nginx
nobody 31679 0.0 0.1 43096 4184 ? S 15:45 0:00 nginx: worker process
root 31712 0.0 0.0 21532 1056 pts/3 S+ 15:47 0:00 grep --color=auto nginx
enter image description here
It's work

How to fix higher memory utilisation in Django instance running on EC2, is it due to multiple running processes of gunicorn.sock?

My Django instance is running on EC2 on top of ubuntu 16.04.2 LTS. I'm getting very slow response from my apis, and during debugging i found out almost all of the memory is utilised.
Here is the screenshot for your reference:
ubuntu#ip-xxx-31-22-205:~/Django/user$ free -m
total used free shared buff/cache available
Mem: 990 860 69 10 60 14
Swap: 0 0 0
Top command doesn't said much about the memory utilisation. Here is the output of ps -aux command
ubuntu#ip-xxx-31-22-205:~/django/user$ ps aux --sort=-%mem | awk 'NR<=10{print $0}'
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 8102 0.1 5.8 311428 59216 ? Sl 05:28 0:03 /home/ubuntu/django/user/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 8108 0.0 5.7 239012 58356 ? S 05:31 0:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 7254 0.0 5.7 239728 58200 ? S May03 0:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 5590 0.0 5.6 239440 57632 ? S May02 0:03 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 6929 0.0 5.6 251536 57340 ? Sl May03 0:02 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 2039 0.0 5.5 179196 56324 ? S 2018 2:08 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14416 0.0 5.5 167712 56096 ? S 2018 1:55 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14461 0.0 5.4 243860 55772 ? S 2018 1:55 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 13520 0.0 4.5 212172 45860 ? S Jan17 1:18 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
Here is the output of ps -ef command:
ubuntu#ip-xxx-31-22-205:~$ ps -ef | grep gunicorn
root 2032 1 0 2018 ? 00:27:04 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 2037 2032 0 2018 ? 00:02:14 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 2039 2032 0 2018 ? 00:02:08 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 2111 1 0 2018 ? 00:27:08 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 2186 1 0 2018 ? 00:27:19 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 5585 1 0 May02 ? 00:00:20 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 5590 5585 0 May02 ? 00:00:03 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 5592 5585 0 May02 ? 00:00:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 6382 1 0 May03 ? 00:00:15 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 6929 6382 0 May03 ? 00:00:02 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 7254 6382 0 May03 ? 00:00:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 7273 14410 0 May03 ? 00:00:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 7276 2111 0 May03 ? 00:00:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 7296 1 0 May03 ? 00:00:12 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 7304 6382 0 May03 ? 00:00:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 7318 5585 0 May03 ? 00:00:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 8102 7296 0 05:28 ? 00:00:02 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 8108 7296 0 05:31 ? 00:00:01 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 8111 7296 0 05:32 ? 00:00:00 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
ubuntu 8189 8168 0 05:48 pts/2 00:00:00 grep --color=auto gunicorn
root 9546 14454 0 Jan13 ? 00:01:24 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 13519 14472 0 Jan17 ? 00:01:20 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 13520 14472 0 Jan17 ? 00:01:18 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 13742 2111 0 Jan17 ? 00:01:19 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14410 1 0 2018 ? 00:24:51 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14416 14410 0 2018 ? 00:01:55 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14454 1 0 2018 ? 00:24:58 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14461 14454 0 2018 ? 00:01:55 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14472 1 0 2018 ? 00:25:02 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14476 2186 0 2018 ? 00:01:56 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14483 2186 0 2018 ? 00:01:54 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 14541 2111 0 2018 ? 00:01:55 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 24952 14454 0 Jan28 ? 00:01:08 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 24953 2032 0 Jan28 ? 00:01:10 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 24955 14410 0 Jan28 ? 00:01:11 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 24956 14472 0 Jan28 ? 00:01:11 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
root 24957 2186 0 Jan28 ? 00:01:09 /home/ubuntu/django/viago/venv/bin/python3 /home/ubuntu/django/viago/venv/bin/gunicorn config.wsgi:application -w 3 --bind=unix:/home/ubuntu/django/viago/gunicorn.sock --preload --log-level=debug --log-file=/home/ubuntu/django/viago/gunicorn.log
What i understood from here that multiple instances of gunicorn is running in the background.
I created one script start_gunicorn.sh to start the gunicorn instance. As far as I understand, I can only start the instance but there is no way with this script to restart or stop the instance. I've two questions here:
Is the multiple instances of gunicorn causing the higher memory consumption? If i kill all the pid's and start gunicorn script, would that help and is safe?
What is the way to restart and or stop the gunicorn instances?