5 ms·
Am I bad SWE if I do not care for for async in django? I am sure a a lot of django devs will like it, but if I need the performance that I would get from going
by game_the0ry 4y ago
Am I bad SWE if I do not care for for async in django?
I am sure a a lot of django devs will like it, but if I need the performance that I would get from going async, I would not being using django as my web framework.
FWIW I like django / python for a lot of things, just not for performance.
- _hcuq 4y agoIt obviously has it’s used, but I have never needed async in my 17 years as a web programmer…
- bastawhiz 4y agoAsync doesn't make your code faster, though there are cases where it lets you handle more requests with a single server (especially if you have code that is async). But moreover, if you have libraries that use async code, it's really not ideal if the thing that runs those libraries isn't async. You don't have to like or want it, but it's there for the folks who want or need it.
- ralmidani 4y agoEnabling async means those already invested in Django can do more on one machine without a complete rewrite, and those considering it can adopt it with fewer reservations. There will always be more scalable platforms out there, but enabling async with Django helps it serve the “sweet spot” in terms of both ergonomics and scalability.
- roflyear 4y agoProbably not. If you need async for DB "stuff" to take advantage of your resources, I think it is a rare thing, and likely you would not want to use the ORM anyway, and then can just do whatever you want without it.
- rossdavidh 4y agoIf you have one part of your app that needs async, but 90% of it is in the sweet spot for Django, then this could be important.
- znpy 4y ago> Am I bad SWE if I do not care for for async in django? In a way, yes. Async in django means that with relatively minor adjustments to your codebase you may significantly increase your requests over time throughput. And as someone else pointed out, if you have database queries that do not depend on each other you can effectively wait for their results in parallel, which might this time not only increase throughput but also lower the total request time. It’s a very valuable development that brings significant gain for relatively minor changes. If you are a professional django developer you should not dismiss such developments like that.
- froza 4y agoit seems most useful for those who want to add simple Websocket support to the existing Django codebase and use the ORM without too much pain
- Demiurge 4y agoNo, I agree with you. It's 2022 and I have thought only once that it would be neat to have async methods from Django, but only as some 'cool thing to try'. I don't actually actually know if there would be any substantial benefit. It's like when I tried PyPy as my django interpreter. It gave a few percent speed increase in "real world" but created extra work for deployment. I've been using Django non-stop from 0.96, and it just works, and you can build around it. If I was running a trading clearing house, or Instagram, I'd probably care about marginal improvements, and then use another language. But for Django, just tuning the workers per server node, and using django-rq jobs works really well. Kudos for the enthusiasts working on this though, because 'async' is a new Python feature/meme, and supporting it is just being a good ecosystem player.
- nilsbunger 4y ago> If I was running a trading clearing house, or Instagram, I'd probably care about marginal improvements, and then use another language. Ha, Instagram was written in Django!
- collinmanderson 4y agoRight, though they're stuck on 1.8 (upgraded to 1.8 only so they could use python3), and really just use it for request/response/views, not ORM or anything else.
- throwaway_4ever 4y agoAre they using DRF? Because obviously mobile app can't use templates and Django doesn't default support REST endpoints, does it?
- collinmanderson 4y ago> Django doesn't default support REST endpoints, does it? You just have to manually call json.parse(request.body) for incoming requests and return JsonResponse(data). And you generally need to serialize the data yourself. Django does have some built-in model serialization, but that's mostly for import/export data, not really for sending to the browser.
- jmconfuzeus 4y agoI don't care about it either. Who's actually doing a ton of querying in their views? We have materialized views for that. I wish Django followed Ruby on Rails a little by focusing on improved developer experience instead of niche features that only a few mega corps need.
- roflyear 4y agoNo. Async in Python is... eh. Rarely is it useful. Sometimes it is, though! Use it when it is useful...