←back to thread

149 points rbanffy | 1 comments | | HN request time: 0.2s | source
Show context
feydaykyn ◴[] No.42151073[source]
The snippets are not false, but there's so much context missing it's easy to worsen the situation, especially for beginners which seem to be the target audience.

First, this guide should emphasize the need to measure before doing anything : django silk, django debug toolbarsm, etc. Of course, measure after the optimizations too, and measure in production with an apm.

Second, some only work sometimes : select_related / prefetch_related / iterator will lead to giga SQL queries with nested joins all over the place, and ends by exploding ram usage. It will help at first, but soon enough one will pay any missing sql knowledge or naive relationships.

Third, caching without taking the context into account will probably lead to data corruption one way or another. Debugging stale cache issues is not fun, since you cannot reproduce them easily.

Fourth, celery is a whole new world, which requires workers, retry and idempotent logic, etc.

Finally, scaling is also about code: architecture, good practices, basic algorithm, etc

I'll end by linking to more complete resources : - https://docs.djangoproject.com/en/5.1/topics/performance/ - https://loadforge.com/guides/the-ultimate-guide-to-django-pe... - https://medium.com/django-unleashed/django-application-perfo...

replies(3): >>42155088 #>>42155739 #>>42156580 #
1. bdzr ◴[] No.42156580[source]
> Third, caching without taking the context into account will probably lead to data corruption one way or another.

One can only hope it's data corruption and not a sensitive data leak.