Considering a Move from Django to FastAPI: Need Advice

0
1
Asked By CuriousCoder42 On

We're currently stuck with a legacy Django monolith that's handling about 45,000 requests per minute and managing over 1,500 database tables. The synchronous ORM calls have become a major bottleneck despite using async views. We're thinking about migrating to an async-native Python framework to address these issues.

We're looking for suggestions that would meet the following criteria:
1. Must be Python-based for easy code porting.
2. Should support an ORM similar to Django.
3. Needs to have a solid community and stability—nothing that's niche or in beta.
4. Should provide feature parity with Django, including an admin interface, template system, signals/receivers pattern, and command-line tools for migrations like `makemigrations` and `migrate`.
5. Currently, we're eyeing FastAPI and Sanic but are open to other suggestions.

If anyone has experience with this kind of migration, I would love to hear about your insights and experiences!

5 Answers

Answered By SkepticalDev On

Just a note: moving to a new framework might not be the ultimate solution. You'd face similar issues with GIL limitations in async frameworks too. Solidify your understanding of where things are failing before jumping into something new.

AnalyticalAlex -

Exactly, and you can’t ignore the potential for complexity when changing your tech stack.

CautiousCoder -

Rewriting in a similar tech stack could lead to more trouble without addressing the underlying issues.

Answered By OptimizationGuru On

Before rewriting your entire app, have you considered profiling your current setup? It could save you lots of headaches by identifying the true pain points. Sometimes performance isn't just about technology, but also about how the code is currently structured.

ProfilerPro -

Definitely critical advice—know your bottlenecks first!

StrategicDev -

So true, mapping out where the issues are will guide you in deciding the right path forward.

Answered By FrameworkFuturist On

Django can handle 45,000 requests per minute if configured properly—maybe there are bugs in your code that you haven't caught yet? Before jumping into a new framework, thorough performance profiling might reveal if you can just optimize what you already have instead.

EagerOptimist -

Good point! A lot of the time the problem can be patched up with just a few optimizations.

QueryMaster -

Yeah, profiling may show that some parts of your platform could run much faster without a complete overhaul.

Answered By TechSavvy99 On

Have you considered why a whole framework overhaul is your first solution? With 1,500 tables, I'm curious about where the actual bottleneck lies. Could it be that certain high-throughput functionalities could be moved to a microservice instead? Perhaps look into whether you have any low-performance queries that can be optimized.

InquisitiveMind85 -

Totally agree with you. Fixing the current issues might be more effective than a wrenching change.

DataDrivenDude -

Exactly! Understanding your bottlenecks is crucial—a full rewrite might not be the best route.

Answered By AsyncEnthusiast On

Have you tried using Django's ORM in async mode? It seems like a daunting task to migrate everything, especially with a decade of business rules built into your existing code. If the main issue is with the synchronous nature of your app, consider scaling your instances horizontally instead of switching frameworks.

RethinkReactor -

I’m also wondering how many Django instances you're currently running! Might be easier to scale those.

CodeChaser -

It's worth noting that it can be tough to get true async with Django's ORM since it still processes DB queries in the same thread.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.