Report this

What is the reason for this report?

How to improve the TTFB for Django ?

Posted on June 26, 2021

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 !!!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.