I am using Django 3.2.3, Apache and Daphne. Daphne is very slow.
I use Apache like a proxy to send the request to Daphne :
<VirtualHost *:443> AllowEncodedSlashes On ServerName mysite.com ServerAdmin ProxyPass "/" "" ProxyPassReverse "/" "" Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET" env=CORS Header set Access-Control-Allow-Credentials "false" env=CORS SSLCertificateFile /etc/letsencrypt/live/****/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/***/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> I launch Daphne with the command :
daphne -p 8001 asgi:application When I access to my website, the log of Daphne are :
2021-06-04 21:17:17,821 INFO Adding job tentatively -- it will be properly scheduled when the scheduler starts 2021-06-04 21:17:17,865 INFO Added job "my_job" to job store "default" 2021-06-04 21:17:17,866 INFO Scheduler started 2021-06-04 21:17:17,909 INFO Starting server at tcp:port=8001:interface=127.0.0.1 2021-06-04 21:17:17,912 INFO HTTP/2 support not enabled (install the http2 and tls Twisted extras) 2021-06-04 21:17:17,913 INFO Configuring endpoint tcp:port=8001:interface=127.0.0.1 2021-06-04 21:17:17,919 INFO Listening on TCP address 127.0.0.1:8001 127.0.0.1:34650 - - [04/Jun/2021:21:18:07] "GET /fr/" 200 234920209 127.0.0.1:34698 - - [04/Jun/2021:21:18:56] "GET /fr/jsi18n/" 304 - It's working, I can display the webpage but it's very very slow, 30sec +
I have no idea of what to search, where to search ...
edit --- Maybe the problem comes from the Apache proxy but I use 127.0.0.1, I do not see why it could be slow. ping 127.0.0.1 is fast.
edit 2 --- Using dig and nslookup on 127.0.0.1 / localhost / SERVER ADDRESS is fast.
Can you help me maybe with some ideas ? or the solution :)
Thank you
1 Answer
Finally I have found.
The problem was not from apche but from my django code. I do not know exactly because I have a made a lot of tests but I think this is because the redis server was not launch.
Thank you