Question

How to improve the TTFB for Django ?

Posted June 26, 2021 93 views
NginxUbuntuServer OptimizationDjango

Hello, I have a Django web site on Ubuntu droplet and its response time varies from 300 to 200 ms. This is not bad but not enough for good ranking in search engines.
I tried 2 times to switch to droplets with better performences but had no change in TTFB at all.
Can someone recommend some ways in server or nginx settings which will help for Django web site ? Thanks in advance !!!

edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

First, 200-300 seconds is very fast. I don’t really see many problems with that, but if you really need to increase the speed, try using installing the django-debug extension/module. It will give you some insights on what’s happening on each request, the SQL queries performed, and such. You can look at that to figure out problems that are making it slower than you expected it to and make it faster.

Also, try caching with something like Redis or Memcached, Django’s default cache system is quite good in this regard.