What I'm doing is avoiding having requests hit Django and serving cached data straight from nginx.
Related question: Django staticgenerator vs CACHE_BACKEND
There seem to be two choices when it comes to this:
https://github.com/torchbox/django-nginx-memcache
https://github.com/mrj0/staticgenerator - This one seems easier to use
After trying django-nginx-memcache I found some downsides:
Which is faster?
Which one would you use and why?
Should I fix the issues that I have with django-nginx-memcache or is staticgenerator just better anyway?
This seems to answer all of my questions and provides a more elegant solution than django-nginx-memcache, that is patching the django cache system: http://www.willmcgugan.com/blog/tech/2009/3/1/fast-caching-with-django-and-nginx/
Static content is almost 4x faster than serving from memcache with nginx.
Request rate: 6243.8 req/s (0.2 ms/req) (static html)
Request rate: 2285.5 req/s (0.4 ms/req) (same html in memcache)
I think I'll go with staticgenerator but please feel free to post your thoughts.
I realized that I'm running two webservers in parallel and I would need a way to sync the cached data if I go with staticgenerator. I guess I could fork it and have it write the files on both servers through network. Any thoughts on this?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With