3 ms·
We used `silk` a lot to profile the app. And basically all the time was being spend inside django somewhere between getting the data from the DB and spitting ou
by Bedon292 6y ago
We used `silk` a lot to profile the app. And basically all the time was being spend inside django somewhere between getting the data from the DB and spitting out the response. We would have things like 15ms in the DB, but 250ms to actually create the response. On simple things. Some of our responses were into multiple second (large amounts of data) but still only spending maybe 150ms in the db. And there was at least two weeks spent on and off trying to improve it before we finally decided we had to go somewhere else. And thats after having to redo some of our queries by hand because the ORM was doing something like 15 left joins.
- ldng 6y agoI'd be curious to know more about those 15 joins. Why do you think the ORM was doing those ? And what DB are you using ?
- Bedon292 6y agoBasically just a complex permission model based on relationships. Much better handled with a subquery. Mostly on is. I don't blame the ORM entirely, but it was more joins than necessary too.
- ldng 6y agoIsee. Would love to find an elegant way to use PostgreSQL permissions system from Django that would result in a great perf boost, no doubt.
- dd82 6y agoYou might be interested in https://hakibenita.com/django-rest-framework-slow https://hakibenita.com/django-rest-framework-slow. If you weren't able to update to a 3.x version that has https://github.com/django/django/commit/a2c31e12da272acc76f3a3a0157fae9a7f6477ac https://github.com/django/django/commit/a2c31e12da272acc76f3..., this might have bit you pretty hard.