Discussions

News: Your Java programs won't scale: A clear and concise explanation as to why

  1. Java applications don't scale. They don't. It's a fact, and it's not even up for debate, although many in the Java community are unwilling to admit it. But it's true. After all, why would there be a need for all of these polyglot programming languages that promote their scalability if there wasn't some severe scalability issues with Java. After all, you don't invest brobdingnagian amounts of time and energy fixing a problem that doesn't exist, do you? And just think about how much time and energy has gone into languages like Scala and Clojure? If we use that as a yardstick to measure how bad things are in the Java ecosystem, then the only conclusion is that when it comes to scalability, Java is at DEFCON ONE.

    Why won't the Java programming language scale, and why is there this huge need to introduce a bunch of new programming languages to fix the problem? The reasons are pretty basic and pretty fundamental, but there are very few resources that pontificate on the issue well. If you want to know why Java won't scale, here's why:

    Part I: Why Java applications fail to scale linearly by Cameron McKenzie
    Part II: Solving the Java scalability paradox by Cameron McKenzie

     

    Follow Cameron McKenzie on Twitter (@potemcam)

    Recommended Titles

    Josh Suereth's Scala in Depth on Amazon.com
    Cay S. Horstmann's Scala for the Impatient
    Martijn Verburg's The Well-Grounded Java Developer
    NoSQL Distilled by Martin Fowler
    Java SE 7 Programming Essentials by Michael Ernest

     

    Threaded Messages (17)

  2. The Problem isn't with Java[ Go to top ]

    Java supports both STM (see Deuce STM) as well as Actor based frameworks (akka, actor factory, jetlang and others). The problem with using explicit locks (primarily around correctness and ease of use) has been known for a long time and most of us are moving away from it without necessarily moving off of Java.

     

     

  3. A Followup to my previous entry[ Go to top ]

    By the way, a good book in this area is 'Programming Concurrency on the JVM' by Venkat Subramaniam. I've heard him speak at SpringOne...he's a hoot.

  4. Reaching out to Venkat[ Go to top ]

    Here's a link to Venkat's book on amazon

    Programming Concurrency on the JVM: Mastering Synchronization, STM, and Actors

    I'm going to reach out to him and see if we can't have him contribute to a feature article/intervew on the topic.

  5. What a crappy article...

    Clojure or Scala can't do anything Java can do. They work on the same JVM, after all. And we know for a fact that Java can successfully work on machines with terabytes of RAM and hundreds of CPUs - it's definitely not easy to write applications at this scale, but it's possible. If anything, Java doesn't scale _down_ well compared to other technologies.

    And proposed solution? STM? It works using atomics and/or locks on the JVM level. And it's not actually that good idea on modern CPUs, especially for highly-contended data. There is a ton of academic literature about STM vs. fine-grained locks - usually fine-grained locks have somewhat better performance and scalability in the real world, but STM-based code is easier to write.

    For example: http://research.microsoft.com/en-us/um/people/tharris/papers/2009-ppopp-quake.pdf

  6. You could have had a good article if you'd named it like 'Big locks are bad in massive multi-core scenarios' (which is somewhat obvious). Nothing specific to any language here.

  7. Only one comment here....[ Go to top ]

    If STM is easier to write (and understand) it is more likely to get right....which is why I emphasized correctness and ease of use in my first reply.

  8. JMS has been used for load/balancing high/availability fault/tolerance for a long time in the enterprise world...

  9. They scale the way i need them to[ Go to top ]

    Quote from the first link: "So for the vast majority of users, the problem Java applications have with achieving linear scalability is simply a trivial point of interest."  I totally agree.

    Sadly the title seems to just to be there to get people to look. And it will confuse many who will say ... see, Java doesn't scale. They will ignore TCO so that they can use an alternative JVM language or non-JVM language.

  10. huh?[ Go to top ]

    how can you make a statement that java applications dont scale?  That is the dumbest thing i have ever heard.  Please tell me how i am achieveing a linear scalability with my java application processing over 88,000 transactions per second?  I am deleting my bookmark to this site as it is terrible anymore with horrible posts and just links to other sites.  There is nothing to add here.

  11. Better[ Go to top ]

    Agreed, can be a bit hit or miss these days. Can you suggest a better site?

  12. Question to the author[ Go to top ]

    Hi, few lines that you outlined as an advantage actually sounded like newer languagues are made keeping in mind careless developers? Btw here are your lines and then you may also want to compare them with the behaviour of thread safe collection of JAVA Concurrent hashmap, I will paste a line from javadoc of that as well.

    "With Scala and Clojure, on the other hand, data tends to be immutable. Since it is immutable, it can't be changed, and since it can't be changed, there is no need to ever lock the data. And rather than editing or changing properties of an object, if a change does need to occur, rather than an edit, an entirely new immutable object is created with new properties, along with a timestamp or equivalent demonstrating that this new piece of data represents a new snapshot in time."

    Here is from ConcurrentHashMap

    "Retrieval operations (including get) generally do not block, so may overlap with update operations (including put and remove). Retrievals reflect the results of the most recently completed update operations holding upon their onset."

     

    Neverthless scala is something I would like to play around with, If people here can share their experiences with Scala and have they taken it to production systems?

  13. Dear Cameron, The articla should be called something like "java programs hard to scale".

    The quote "With Scala and Clojure, on the other hand, data tends to be immutable. Since it is immutable, it can't be changed, and since it can't be changed, there is no need to ever lock the data" emphasize this exactly - also in Java you can program code that tends to be immutable. Ask the Spring guys ...

  14. OR better yet "Java has limits to scalability but you probably will never reach them"

  15. bs article[ Go to top ]

    If Java would not be scalable, then why is java still used to provide the core functionality. E.g. the actors framework relying on java implemented queue implementations or the java implemented ForkJoinPool. 

    Imho this is a bs article... not to be taken seriously..  But who is taking the Serverside seriously these days. 

  16. bs article[ Go to top ]

    Then what's your recommended java tech sites?

  17. Lame article[ Go to top ]

    That is a lame article. It has nothing to do with Java. Writing non-trivial applications that scale easily is hard no matter the language you use. Guess what, it takes real experience, skill and dedication. The real problem isn't the language or even the JVM.

    The problem has always been cultural. Business users often don't know what they want and make contradictory demands. Even developers don't know what functionality is really needed until they get feedback from the users.

  18. My Java programs always scale.