diff --git a/src/app.py b/src/app.py index 599c0d1..e53163d 100644 --- a/src/app.py +++ b/src/app.py @@ -44,7 +44,7 @@ # Log rotation is handled via logrotate on the host system with a configuration file # Do NOT handle log file and rotation via the Python logging to avoid issues with multi-worker processes logging.basicConfig(format='[%(asctime)s] %(levelname)s in %(module)s: %(message)s', - level=logging.DEBUG, + level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S') logger = logging.getLogger(__name__) diff --git a/src/uwsgi.ini b/src/uwsgi.ini index 83732ad..86bc063 100644 --- a/src/uwsgi.ini +++ b/src/uwsgi.ini @@ -1,12 +1,8 @@ [uwsgi] -# Need this plugin since uwsgi and uwsgi python plugin are installed with yum -# If uwsgi installed with pip, no need this -plugin = python36 - # So uwsgi knows where to mount the app chdir = /usr/src/app/src -# Application's callbale +# Application's callable module = wsgi:application # Location of uwsgi log file @@ -16,12 +12,14 @@ logto = /usr/src/app/log/uwsgi-ingest-api.log # By default uWSGI allocates a very small buffer (4096 bytes) for the headers of each request buffer-size = 32768 -# Master with 2 worker process (based on CPU number) +# Master with 16 worker processes (based on CPU number) master = true -processes = 2 +processes = 16 -# Enable multithreading for ingest-api -enable-threads = true +# Enable the multithreading within uWSGI +# Launch the application across multiple threads inside each process +enable-threads = True +threads = 16 # Use http socket for integration with nginx # 127.0.0.1:5000 or localhost:5000 won't work with Docker @@ -33,3 +31,5 @@ vacuum = true # Ensure compatibility with init system die-on-term = true + +attach-daemon = python worker.py