Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple HTTP sockets with map-socket: the second HTTP socket is very slow #2649

Open
mmartinello opened this issue Jun 4, 2024 · 0 comments

Comments

@mmartinello
Copy link

I am making some tests on uWSGI 2.0.25.1 with multiple HTTP sockets and map-socket in order to avoid socket busyness due to healthchecks from HAProxy.

I enabled 2 HTTP sockets and 4 processes, and I mapped 3 processes for the first socket (for application) and the 4th process for the second socket (for monitoring and healthchecks):

http-socket = :8000
http-socket = :8001
map-socket=0:1,2,3
map-socket=1:4
processes = 4

As a result, the first socket on the port 8000 works and is fast as it should be:

root@154dc56d3a27:/opt/app# time http -h 127.0.0.1:8000
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 174
Content-Type: text/html; charset=utf-8
Cross-Origin-Opener-Policy: same-origin
Referrer-Policy: same-origin
Vary: Authorization, Cookie, origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

real	0m0.158s
user	0m0.108s
sys	0m0.040s

If I try to connect to the second socket (port 8001), the connection hangs and the socket seems not to serving anything:

root@154dc56d3a27:/opt/app# time http -h 127.0.0.1:8001
[...] No response [...]
^C

real	0m10.855s
user	0m0.133s
sys	0m0.012s

This is my uwsgi.ini file:

[uwsgi]
strict = true
master = true
enable-threads = true
vacuum = true
single-interpreter = true
die-on-term = true
need-app = true
lazy-apps = false
no-defer-accept = true
py-call-osafterfork = true
thunder-lock = true

# Avoid errors on aborted client connections
ignore-sigpipe = true
ignore-write-errors = true
disable-write-exception = true


disable-logging = true
log-5xx = true
log-date = %%Y-%%m-%%d %%H:%%M:%%S
logformat-strftime

log-format = [pid: %(pid)|app: -|req: -/-] %(addr) (%(user)) {%(vars) vars in %(pktsize) bytes} [%(ctime)] %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs (%(proto) %(status)) %(headers) headers in %(hsize) bytes (%(switches) switches on core %(core))
logger = file:/var/log/uwsgi/logger.log
req-logger = file:/var/log/uwsgi/req-logger.log

harakiri = 3600

max-requests = 1000
max-worker-lifetime = 3600
reload-on-rss = 2048
worker-reload-mercy = 60

#processes = 2

cheaper-algo = busyness
cheaper = 1
cheaper-initial = 1
cheaper-overload = 1
cheaper-step = 1

cheaper-busyness-multiplier = 30
cheaper-busyness-min = 20
cheaper-busyness-max = 70
cheaper-busyness-backlog-alert = 64
cheaper-busyness-backlog-step = 2


#http-socket = :8000

http-timeout = 120
http-connect-timeout = 120
http-enable-proxy-protocol = 1
http-auto-chunked = true
http-keepalive = 1
add-header = Connection: Keep-Alive

chdir = .
wsgi-file = /opt/app/wsgi.py

gid = app
uid = app

pidfile = /tmp/project-master.pid


route = ^/info* donotlog:

stats = :1785
stats-http = true

http-socket = :8000
http-socket = :8001
map-socket=0:1,2,3
map-socket=1:4
processes = 4

Could you help me to understand where I'm wrong, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant