Skip to content

Commit

Permalink
Merge pull request #5 from tiangolo/default-workers-per-core-1
Browse files Browse the repository at this point in the history
Update default workers_per_core to 1, and min concurrency to 2
  • Loading branch information
tiangolo authored Mar 4, 2019
2 parents 57ff364 + 1b5393d commit 829c445
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions python3.6-alpine3.8/gunicorn_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import multiprocessing
import os

workers_per_core_str = os.getenv("WORKERS_PER_CORE", "2")
workers_per_core_str = os.getenv("WORKERS_PER_CORE", "1")
web_concurrency_str = os.getenv("WEB_CONCURRENCY", None)
host = os.getenv("HOST", "0.0.0.0")
port = os.getenv("PORT", "80")
Expand All @@ -20,7 +20,7 @@
web_concurrency = int(web_concurrency_str)
assert web_concurrency > 0
else:
web_concurrency = int(default_web_concurrency)
web_concurrency = max(int(default_web_concurrency), 2)

# Gunicorn config variables
loglevel = use_loglevel
Expand Down
4 changes: 2 additions & 2 deletions python3.6/gunicorn_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import multiprocessing
import os

workers_per_core_str = os.getenv("WORKERS_PER_CORE", "2")
workers_per_core_str = os.getenv("WORKERS_PER_CORE", "1")
web_concurrency_str = os.getenv("WEB_CONCURRENCY", None)
host = os.getenv("HOST", "0.0.0.0")
port = os.getenv("PORT", "80")
Expand All @@ -20,7 +20,7 @@
web_concurrency = int(web_concurrency_str)
assert web_concurrency > 0
else:
web_concurrency = int(default_web_concurrency)
web_concurrency = max(int(default_web_concurrency), 2)

# Gunicorn config variables
loglevel = use_loglevel
Expand Down
4 changes: 2 additions & 2 deletions python3.7-alpine3.8/gunicorn_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import multiprocessing
import os

workers_per_core_str = os.getenv("WORKERS_PER_CORE", "2")
workers_per_core_str = os.getenv("WORKERS_PER_CORE", "1")
web_concurrency_str = os.getenv("WEB_CONCURRENCY", None)
host = os.getenv("HOST", "0.0.0.0")
port = os.getenv("PORT", "80")
Expand All @@ -20,7 +20,7 @@
web_concurrency = int(web_concurrency_str)
assert web_concurrency > 0
else:
web_concurrency = int(default_web_concurrency)
web_concurrency = max(int(default_web_concurrency), 2)

# Gunicorn config variables
loglevel = use_loglevel
Expand Down
4 changes: 2 additions & 2 deletions python3.7/gunicorn_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import multiprocessing
import os

workers_per_core_str = os.getenv("WORKERS_PER_CORE", "2")
workers_per_core_str = os.getenv("WORKERS_PER_CORE", "1")
web_concurrency_str = os.getenv("WEB_CONCURRENCY", None)
host = os.getenv("HOST", "0.0.0.0")
port = os.getenv("PORT", "80")
Expand All @@ -20,7 +20,7 @@
web_concurrency = int(web_concurrency_str)
assert web_concurrency > 0
else:
web_concurrency = int(default_web_concurrency)
web_concurrency = max(int(default_web_concurrency), 2)

# Gunicorn config variables
loglevel = use_loglevel
Expand Down
4 changes: 2 additions & 2 deletions tests/test_01_main/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

def verify_container(container, response_text):
config_data = get_config(container)
assert config_data["workers_per_core"] == 2
assert config_data["workers_per_core"] == 1
assert config_data["host"] == "0.0.0.0"
assert config_data["port"] == "80"
assert config_data["loglevel"] == "info"
assert config_data["workers"] > 2
assert config_data["workers"] >= 2
assert config_data["bind"] == "0.0.0.0:80"
logs = get_logs(container)
assert "Checking for script in /app/prestart.sh" in logs
Expand Down
4 changes: 2 additions & 2 deletions tests/test_01_main/test_env_vars_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def verify_container(container, response_text):
config_data = get_config(container)
assert config_data["workers_per_core"] == 1
assert config_data["workers_per_core"] == 2
assert config_data["host"] == "0.0.0.0"
assert config_data["port"] == "8000"
assert config_data["loglevel"] == "warning"
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_env_vars_1(image, response_text):
container = client.containers.run(
image,
name=CONTAINER_NAME,
environment={"WORKERS_PER_CORE": 1, "PORT": "8000", "LOG_LEVEL": "warning"},
environment={"WORKERS_PER_CORE": 2, "PORT": "8000", "LOG_LEVEL": "warning"},
ports={"8000": "8000"},
detach=True,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_02_app/test_custom_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

def verify_container(container, response_text):
config_data = get_config(container)
assert config_data["workers_per_core"] == 2
assert config_data["workers_per_core"] == 1
assert config_data["host"] == "0.0.0.0"
assert config_data["port"] == "80"
assert config_data["loglevel"] == "info"
assert config_data["workers"] > 2
assert config_data["workers"] >= 2
assert config_data["bind"] == "0.0.0.0:80"
logs = get_logs(container)
assert "Checking for script in /app/prestart.sh" in logs
Expand Down
4 changes: 2 additions & 2 deletions tests/test_02_app/test_package_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

def verify_container(container, response_text):
config_data = get_config(container)
assert config_data["workers_per_core"] == 2
assert config_data["workers_per_core"] == 1
assert config_data["host"] == "0.0.0.0"
assert config_data["port"] == "80"
assert config_data["loglevel"] == "info"
assert config_data["workers"] > 2
assert config_data["workers"] >= 2
assert config_data["bind"] == "0.0.0.0:80"
logs = get_logs(container)
assert "Checking for script in /app/prestart.sh" in logs
Expand Down
4 changes: 2 additions & 2 deletions tests/test_02_app/test_simple_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

def verify_container(container, response_text):
config_data = get_config(container)
assert config_data["workers_per_core"] == 2
assert config_data["workers_per_core"] == 1
assert config_data["host"] == "0.0.0.0"
assert config_data["port"] == "80"
assert config_data["loglevel"] == "info"
assert config_data["workers"] > 2
assert config_data["workers"] >= 2
assert config_data["bind"] == "0.0.0.0:80"
logs = get_logs(container)
assert "Checking for script in /app/prestart.sh" in logs
Expand Down

0 comments on commit 829c445

Please sign in to comment.