Killersites.com - Web Design Resources

View Cart

Java’s dirty little secret: Java web hosting is fragile.

PHP vs Java - is Java really more stable?

When people think of Java, they think of some mighty indestructible language/environment that never goes down – well at least less than other platforms like PHP or .NET.

REALITY CHECK

After running my own servers for 6 years (IIS with Resin) with few troubles, I moved hosting to outside sources. I had to go through several hosting companies before I found one that could even run my simple POJO based applications!

Now after a year has passed, my experience with shared Java hosting can be summarized:

  • Tomcat seems to go down at least once every 7-14 days.
  • Contrast this to PHP – never goes down.

FINAL COMMENTS

The Java community tends to dismiss PHP as some scrappy scripting language that can’t be counted on … I must confess, I used to think that too.

Now after a year of using both Java based and PHP based applications, I have personally found PHP to be much more stable and reliable. I am actually nervous that my Java applications (and Tomcat) will fail regularly and am moving to migrate everything to PHP.

I have no axe to grind, just speaking the truth based on my experience.

Stefan Mischook (The Web Design Heretic)

25 Responses to “Java’s dirty little secret: Java web hosting is fragile.”

  1. Rob Says:

    Someone tried to tell me that ColdFusion is more stable/reliable than PHP, is there any truth to this?

    My experience is very limited with .cfm but the person who told me this is also having problems getting a simple query done in ColdFusion, something I can write into a script in half a second.

  2. Stefan Mischook Says:

    "Someone tried to tell me that ColdFusion is more stable/reliable than PHP, is there any truth to this?"

    ColdFusion is now made with Java/J2ee, so I somehow doubt it. That said, it could be that Macromedia built into ColdFusion a much more stable engine than what I have seen with Tomcat? So Coldfusion could be a rock.

    Again, over the last year, I have never had a problem with my PHP applications going down … only the Java apps.

     -

    ColdFusion was designed for web designers and thus is a tag based system; if you are not comfortable with learning how to code, ColdFusion maybe the choice for you.

    Another plus for ColdFusion, is the availability of libraries that can do things like graph data and create calendars – it’s a good RAD (rapid application development) tool. But, you can find all that (easily) with PHP too …

    Then their is that persky hosting thing; PHP hosting is everywhere. How often do you see ColdFusion hosting?

  3. Chris Says:

    I think it depends on how complex your app is. We use Java for our incredibly complicated business app at work–there no way PHP could handle it.

    But if you are work on something even marginly middle of the road in terms of complexity–you’re right, PHP is more stable and is probably the way to go.

  4. Vincent Murray Says:

    I have had good and bad experience with hosting of my Java sites. When I hosted on my own Linux box with Tomcat – the site never went down.

    I had bad experiences with “shared” Tomcat because other clients were still “testing” and crashed Tomcat (webserve.ca) At least that is what they told me.

    Now I am hosting with blacksun.ca and all is smooth.

    PHP is a scripting language – very good. Java is a multi-threaded object-oriented enterprise scaled software development progamming language (and virtual operating system) :)

    There is no real comparison when a thousand hits come in at the same time.

  5. Stefan Mischook Says:

    @Vincent Murray,

    “There is no real comparison when a thousand hits come in at the same time.”

    I have found (as has Yahoo!) that PHP does indeed scale well.

    Many of the complaints against PHP has much more to do with bad programmers, and not with the language itself. Now PHP is fully OO, has ORM and MVC constructs and can be obfuscated.

    -
    I think that Java will be used less and less over time to build business apps. Java will always have its’ place as an infrastructure language … but for typical business logic, you are much better off with more agile languages like PHP, Ruby or perhaps some scripting language that will sit on-top of the JVM (Groovy, JRuby ??).

  6. Java Hosting Says:

    Nice thread, but I think that you should ask your hosting provider how often they restart their Tomcat server. If they do that every 24/48 hours you should not have any problems with it.

  7. what? Says:

    Are you kidding me?

    Problems with Tomcat does not equate to problems with Java. A lot of Tomcat is written in C.

    Your problems might be related to Java, but might be your code was crap, something might have been buggy in Tomcat, or the web host sucks.

  8. Stefan Mischook Says:

    “might be your code was crap, something might have been buggy in Tomcat, or the web host sucks.”

    I personally think it is more or less a Tomcat thing … it is not the most stable thing out there.

    Beyond that, Java is a pig when it comes to resources. I now run my own Linux servers again and I can tell you that the Java footprint is significant.

  9. Neale Says:

    Java/Tomcat can be a little fragile when not maintained correctly. On a host that specialises in Java however, you should not have problems like you have described. If you do, change hosts.

  10. Dan Says:

    I have been doing java web development for about 6 years now. I have developed using weblogic, tomcat, and the sun application server. I have used struts, jsf, hibernate, jstl, ejb 3, and many of the java technologies in my applications. I have deployed applications to Windows, FreeBSD, Solaris and Linux. I have to say that Java has been rock solid in all of the configurations.

    I have a feeling that if you are having instability issues that it is probably due to the server configuration itself and not with Java.

  11. Thomas Whitmore Says:

    Not at all. I’ve never experienced *any* significant unreliability in Tomcat, other than the fact it will OutOfMemory after a finite number of application reloads.

    Been building industrial-strength applications with it for years, too. Numbers of them.

    I have a communications gateway, not even web or HTTP- based; parser, sender & conversation controller modules, just deployed on Tomcat as a convenient platform.

    There were some problems last year and several things fell over. Windows license expiry, power, network, MySQL (3x now) all fell over in a variety of separate incidents. Just about only thing left functioning was the gateway… hardened fault tolerant, trying to call it’s server on a steady 35 second interval. :)

    Of course it’s destination, being a test server in another city… mostly isn’t available. So we get beautifully formatted, self rolling log of client-side connection, setup & a nice error report of outbound failure… and then retry after a brief delay.

    Experience so far, is that the entire rest of the house can fall down and this will keep on running. As for PHP for military reliability applications… maybe not.

    (Not military purpose, we just build Tough because we can.)

  12. RW Says:

    There is a product that web hosts can use
    to enable Private JVM JAVA Hosting, called
    NGASI (http://www.ngasi.com)

    It is an addon for the popular web control panels, such as Plesk and cPanel.

    Each user account is able to install their own
    Application Server and run it under their own
    JVM instance. So each user have full
    control of configuration, etc. – just as if running
    on their own server.

  13. Salaboy Says:

    i think, the one who wrote this article never did an application big enough with php.
    IMHO i think he/her never use any persistence framework, never wrote a web service, and never ever heard about a transaction…

  14. Stefan Mischook Says:

    @Salaboy,

    I never wrote huge enterprise level applications – this is true. Perhaps the largest single system I wrote had maybe 60 tables and 40-50 UI’s.

    I have used persistence frameworks (a couple,) have used transactions a lot – even small application will need transactions often enough. But you do have me on web services – I never built those with Java.

    That said, PHP has all of these things:

    - transaction support
    - web services
    - persistence frameworks

    CIAO

  15. John Says:

    I work at a large dot com in San Francisco and I gotta say, we have such high traffic demands that PHP alone without significant caching could not handle the load we get. My application runs on 4 beastly dual opteron machines with 16 gigs of RAM and they have never gone down in over two years (running Resin). We get about 10 requests a second (which is low), but some of our other sites get over 2,000 requests a second! I am honestly doubtful that PHP could handle that.

  16. Stefan Mischook Says:

    “we have such high traffic demands that PHP alone without significant caching could not handle the load we get.”

    Interesting comments and perhaps true. But, what makes you say that? Do you have personal experience to back that up?

    Thanks!

    Stefan

  17. Bill Says:

    Comparing PHP to Java is like comparing a Volkswagen to the Space Shuttle. It’s really sort of silly if you’ve had a lot of experience with both.

    PHP is a great scripting language but Just try building a large-scale Enterprise application, with complex business logic, using PHP. You’ll end-up with an absolute mess and the performance will be nightmare because it will not scale.

    Someone mentioned Yahoo using PHP and that’s great. But scaling a heavily trafficked web site is a whole lot easier than scaling a heavily loaded multi-tiered application with dozens or even hundreds of discrete components. That is where J2EE shines.

    I think it is very much true that PHP has a huge advantage over Java in a shared-web hosting environment. Classloader issues, security policy issues, etc make hosting multiple sites under one Tomcat instance very challenging and this accounts for the vast majority of down-time with Java apps in a shared hosting environment. Every time one user makes a code change the server needs to be restarted which, unfortunately, knocks everyone else off. This problem doesn’t exist with PHP.

    But in a corporate data center environment where changes are tightly controlled, Java is at least as stable as anything else out there and MUCH more powerful than languages like PHP.

  18. Stefan Mischook Says:

    Bill,

    How about we say php is a porsche and Java is a truck.

    … Java is great if you have huge projects. But for most web projects out there, PHP will drive circles around Java.

  19. Party Midgets Says:

    I’ve been using Java web hosting from http://www.ubiquityhosting.com for quite some time, and it’s always worked just fine. If Tomcat is inaccessible once a week, I would really contact your host; something clearly needs to be fixed there.

  20. George Penev Says:

    Ask your Private JVM JAVA provider for your max HEAP size? It is really uncomfortable question, as soon as it is not cost effective, to be unable to share unused memory, so only solution for your provider is to give to his customers small max Heaps. And if he delivers you about Heap about 2GB , it is sure most of the time you will use Slow Swap Memory, because thats the only chance for such solutions. Cheers!

  21. Brad Cathey Says:

    My company has been using the same install of Tomcat on our intranet server for 7 years (yes, it is that old!). I think we have had to reboot twice because of Tomcat related issues in that period.
    I think everyone will agree that PHP is a good scripting language that can scale up well, provided caching. Web Services, and certain IDE benefits may not be a shinning area… I think everyone can also agree that Java (frameworks/implementations) have bumped the walls quite a few times before they got things straight (ie J2EE). The fact is you should make your choice based on your skill level and your project requirements (as always). Never base a solution on hype. If you do, you are destined to become a marketing manager someday! haha

  22. Stefan Mischook Says:

    Hi,

    “Tomcat on our intranet server for 7 years”

    That is the key; you having total control over the server.

    I ran Resin servers for years with no problems, it was only when I went to 3rd party hosting did I run into trouble.

    But I have to tell you, it has been about 2 years now that we’ve pushed a lot of our apps to PHP and something is strangely missing … the server set up problems.

    Stefan

  23. Gavin Says:

    I’d steer clear or ubiquity hosting. they’ve been the worst move i ever made. After spending over $7,000 on setup fees their servers couldn’t handle 150,000 page views per day let alone java! be very careful!

  24. Stefan Mischook Says:

    What?

    $7,000! What the heck did they do?

    Stefan

  25. Gavin Says:

    they said they were setting up a cluster server. sadly it didn’t ever work. they blamed our code so we tried numerous other download tests etc and nothing even came close to the page/image load that a cluster server should do.

© 2009 - Killersites.com - All rights reserved
  • Hosting and domain name support:
  • (480) 624-2500

PayPal Customer Support: 1-888-221-1161

Killersites.com has been a PayPal Verified Merchant since 2001. We also accept payment via check or money order.

Please send payment to:

Killersites.com Inc. 4156 Dorchester #2 Westmount, Quebec Canada H3Z 1V1

The more you learn, the more you earn!

Subscribe to our newsletter
Unsubscribe