DEV Community

Discussion on: Express.js vs Django, which framework should I learn ??

Collapse
 
nestedsoftware profile image
Nested Software • Edited

I think the question is very general, so it's hard to answer. For example, if your main concern is finding a job, then the intrinsic merits of the technology don't matter. What matters is how many companies are hiring for each of these technologies. I don't know the answer, but it should be possible to do some searches of well known job sites to get an idea.

From a technology standpoint, I think the single biggest difference is the concurrency model:

In Node, I believe all requests for a given process are handled by a single thread, and the concurrency for all users being served by that process is done cooperatively within a single thread. That means you have to be very careful about crafting your code so that no one task is taking up too much CPU, or else the responsiveness will drop for all of your users.

On the other hand, if you have a lot of users who are doing small bits of I/O bound work on your site, then adding more concurrent users should be easier in a node application, at least in theory.

In Django, I believe a certain number of threads are allocated to a python process. Since threads are pre-emptive, you don't need to worry about the problem of one part of your application hogging the CPU as much.

However, it also means that, at least in theory, the concurrency model is more resource-intensive in a technology like django. My understanding is that in Linux one can spawn thousands of threads without it being a huge problem. That means that whether this issue matters to you in practice really depends on the kind of scalability you need.

Recent versions of Python have incorporated support for the event loop-driven concurrency model that Node has, but I kind of doubt that Django supports this - not sure though.