DEV Community

Cover image for Is Python or Java a better language for scaling as your web app grows in size?
Prahlad Yeri
Prahlad Yeri

Posted on

Is Python or Java a better language for scaling as your web app grows in size?

The choice between Python and Java when it comes to web development is both intriguing and interesting. Former is a dynamic, interpreted and a more "English like" programming language which feels like a breeze while coding and latter is a statically typed, compiled and a bit more "discipline oriented" language which boasts of more bare metal performance (at least in theory).

In an ideal world where hardware costs are negligible and developer productivity is the only (or major) criteria for choosing a language, Python should always win. But that's already happening now, isn't it!

If you look at the TIOBE popularity stats for May, 2021, it seems as though there is a cut-throat competition between Python and Java with Python at 11.87 and Java at 11.74 rating. If these stats are to be believed, both Java and Python are equally preferred out in the wild.

But I don't think that's really happening, at least not in the open source web development world. Python frameworks like Django and Flask are not only ubiquitous among startups and mid sized businesses, you also stumble upon their proponents and problem solvers every now and then in places like Stack Overflow, Reddit and even Dev.TO. It never takes a long time to find an expert helping hand if you come across a problem in any of the popular open source python libraries.

And while the Java enthusiasts keep talking about how mind blowing their spring-boot framework is, I'm not seeing a lot of takers for it at least in the FOSS spectrum. None of the popular online social media platforms like Reddit, Quora, Tildes, etc. use Java, they are all based on a Python or PHP framework.

Now it might well be the case that a good number of humble and creative Java engineers are running lots of cool stuff like Spring-boot behind the closed walls of those corporate enterprises but how are we supposed to know about that, right!

Indeed, if the performance advantage of Java is taken into consideration for a moment, there ought to be lots of stuff running in the open source spectrum as Java is open source too. Granted that its a bit verbose and the number of classes and interfaces you write may increase drastically with the app size but that's no big deal in the long run if your AWS bills also come down due to better performance, isn't it?

Are there any known benchmarks or studies done on any AWS or Linode instances regarding which language performs better at the same level of scaling (like # of web requests per second for example)? If there are, it will be interesting to see their results!

Top comments (4)

Collapse
 
aghost7 profile image
Jonathan Boudreau

When it comes to scaling a web app, the language choice doesn't really matter. Most of the issues you will face are going to relate to how data is stored and retrieved, not how business logic is written.

Even dev.to is based on Laravel PHP Framework!

It is actually based on Rails.

Collapse
 
prahladyeri profile image
Prahlad Yeri

not how business logic is written.

It may not matter in the larger picture where other factors like database, network speed or capacity, etc. all take a piece of the pie but still, doesn't the fact that compiled languages perform way better than interpreted matter at all?

It is actually based on Rails.

Thanks, I fixed it now.

Collapse
 
aghost7 profile image
Jonathan Boudreau

It does matter, just not to an extent that it usually offsets the cost of the additional development effort required. This is a different story in the embeded world for example, where the performance will impact margins far more.

Collapse
 
prahladyeri profile image
Prahlad Yeri • Edited

While its true that hardware resources like cloud hosting, RAM, CPU, etc. cost money but its also true that programmers cost money too! The wise ones try to figure it out by working out which factor is more costlier given their individual circumstances (type of project, locality and cost of living, average engineer salary, etc.) and based on the anecdotal evidence, it seems Python and PHP are doing a better job of convincing these startups that they are the more cost effective overall.

I will start believing otherwise when I will see large platforms like Quora, Reddit, Tildes, Dev.TO, etc. rewriting their code in Java and moving away from the interpreted languages. Why isn't any major open source platform or software like Wordpress, Drupal, Django, Flask, Laravel, etc. written in Java (with the sole exception of spring-boot)?