Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Java Vs. C#: Which Performs Better In the 'Real World'?

timothy posted about 2 years ago | from the oh-you-tease dept.

Java 437

Nerval's Lobster writes "Software developer Jeff Cogswell writes: 'Let's compare Java and C#, two programming languages with large numbers of ardent fans and equally virulent detractors. I'm not interested in yet another test that grindingly calculates a million digits' worth of Pi. I want to know about real-world performance: How does each language measure up when asked to dish out millions of Web pages a day? How do they compare when having to grab data from a database to construct those pages dynamically? The results were quite interesting.' Having worked as a professional C# programmer for many years, Cogswell found some long-held assumptions challenged."

Sorry! There are no comments related to the filter you selected.

Language is hardly relevant (5, Insightful)

InterBigs (780612) | about 2 years ago | (#42616419)

When talking about large-scale websites the language is hardly relevent. There are as many high-traffic sites running on C#, Java, PHP or whatever. When facing large scale other factors play a much larger role. The only exception is when you're talking Facebook or Twitter scale: Facebook has practically reinvented PHP and also has some parts of their code in C (or C++, not sure) and Twitter made a switch from Ruby to Scala in order to handle the onslaught of users. The results mentioned in the article (accepting 2000 requests takes 600ms longer when using simple code) are not that interesting in this context.

Re:Language is hardly relevant (5, Insightful)

QBasicer (781745) | about 2 years ago | (#42616537)

This is more a comparison between runtimes and servers, and less about language.

The reason this is interesting, is it's a very simple test, and hows the maximum performance. Requests can never be faster than returning a simple string. CLR + ISS is slower than JVM + Tomcat. Unfortunately, we don't know where exactly the performance difference lies.

Re:Language is hardly relevant (5, Interesting)

samkass (174571) | about 2 years ago | (#42616677)

It's also interesting to note that all tests were done on Windows. Despite him using Tomcat for Java and IIS for C# because that's the "typical" usage, he then completely does an about-face and deploys the Tomcat on Windows-- a configuration I've actually never seen and which has to give C# a bit of an advantage as the vendor-supplied OS. And yet Java still won when talking about doing anything substantial...

Re:Language is hardly relevant (2, Insightful)

Anonymous Coward | about 2 years ago | (#42616833)

You've gotta be kidding.

Hey, I know of this great conspiracy site...

Re:Language is hardly relevant (2)

Electrawn (321224) | about 2 years ago | (#42616835)

I also add the tests were run on cloud servers, which is a time share environment.

Also, I would have used TC server instead of tomcat. Or another java enterprise JSP container.

Re:Language is hardly relevant (5, Insightful)

squiggleslash (241428) | about 2 years ago | (#42616843)

I've seen Tomcat on Windows a lot. Remember that most Enterprise environments until relatively recently used Windows for everything, but also bought into Java as the development platform to standardize on. Developers would be required to develop Java under Windows, and the Gods of IT would refuse to countenance a Linux server in their server room even if the developers wanted Windows.

RHEL's rise has changed things somewhat, but it's still a common combination.

Re:Language is hardly relevant (5, Informative)

darjen (879890) | about 2 years ago | (#42616973)

I been a Java developer for 8 years, worked at several different consulting companies and large in-house corporate environments. I've never seen Windows+Tomcat being used in an actual production setup. For development, yes, almost always. But Linux+Tomcat is much more common for live servers in my experience. At least it is in today's business world.

Re:Language is hardly relevant (3, Informative)

red_dragon (1761) | about 2 years ago | (#42617061)

... he then completely does an about-face and deploys the Tomcat on Windows-- a configuration I've actually never seen and which has to give C# a bit of an advantage...

The official Tomcat installer for Windows (as in, the one that you'd download from tomcat.apache.org [apache.org] installs the Tomcat Native Connector, which improves performance considerably. And there's a lot of vertical market applications for Windows that bundle Tomcat.

Re:Language is hardly relevant (5, Insightful)

Anonymous Coward | about 2 years ago | (#42616909)

The reason this is interesting, is it's a very simple test, and hows the maximum performance. Requests can never be faster than returning a simple string. CLR + ISS is slower than JVM + Tomcat. Unfortunately, we don't know where exactly the performance difference lies.

Nope, maybe that's what author think's he's doing, but he clearly doesn't understand the stacks.

For .NET, he's using the entire ASP.NET MVC framework to return a simple string. For Java, he's just using a bare servlet, and no framework code. To make this a fair test, he should be using Spring or something on the Java side.

Re:Language is hardly relevant (5, Funny)

cod3r_ (2031620) | about 2 years ago | (#42616557)

Assembly is the only way to go when it comes to database oriented web apps.

Re:Language is hardly relevant (5, Funny)

squiggleslash (241428) | about 2 years ago | (#42616759)

No, that's not fine tuned enough. Standard practice here is to program an FPGA to do the less important work, with wire wrapped transistors doing anything that needs to perform well.

Anything less is, well, lazy.

Re:Language is hardly relevant (4, Funny)

sideslash (1865434) | about 2 years ago | (#42617091)

At my shop we engineer universes to produce all desired output at the exact moment it's needed with zero latency. It's a highly parallelized operation. Unfortunately, we currently occupy one of the universes that got mostly wrong answers.

Re:Language is hardly relevant (3, Interesting)

zifn4b (1040588) | about 2 years ago | (#42617047)

Assembly is the only way to go when it comes to database oriented web apps.

This is what I find funny about C++ zealots who hate .NET and java. Interestingly enough, Microsoft had an incubating effort to build a "framework" called Casablanca that would give C++ developers an easy way to host a web server or a RESTful web service. Part of the C++11 standard is incorporating features in languages like C# and java. It's interesting to watch the pendulum shift back and forth and the philosophical arguments being argued from ivory towers.

Re:Language is hardly relevant (5, Insightful)

PhrostyMcByte (589271) | about 2 years ago | (#42616701)

C# 5.0 (the latest version) has language-integrated async functionality that makes writing vertically scalable software a snap. It looks and behaves almost exactly like sync code, but actually runs async. Talking about server-side async here, not client-side.

Doing the same thing with Java or an older version of C#, where you have only the base libraries to help you, is really quite tedious to do properly.

So, for a test like this involving web development, I'd say language is actually a pretty relevant topic. Unless you've got lots of money to spend and can throw more hardware at something, the kind of perf improvement that can be provided by this is pretty astounding.

But, there are problems with this test. He says explicitly that he's looking for a real-world test, but then goes and basically times a Hello World. There is no database access, no concurrent users. No real-world anything.

Re:Language is hardly relevant (-1)

Anonymous Coward | about 2 years ago | (#42616963)

This is /., faggot. We use C and assembler here. We don't write multi-threaded code. We don't use C#, you M$ $hill. M$ won't port all the .NET libraries to linux for free and hand out the source code and provide a proper C# compiler and provide the source code for that compiler and all associated build tools. For FREE. Fuck M$.

Re:Language is hardly relevant (0)

jasmusic (786052) | about 2 years ago | (#42617097)

On top of this, there's no way in hell the .NET CLR runs slower than Sun's JVM. Even when MS was creating a competing JVM theirs was faster than Sun's.

Re:Language is hardly relevant (2, Informative)

Anonymous Coward | about 2 years ago | (#42617071)

Facebook has practically reinvented PHP and also has some parts of their code in C (or C++, not sure)

Facebook has significant parts in C++, and employed people like Andrei Alexandrescu [wikipedia.org] to do some of the heavy lifting. He has given some talks with regards to computational efficiency in C++ for Facebook, based on his work.

Re:Language is hardly relevant (5, Insightful)

Anonymous Coward | about 2 years ago | (#42617139)

Unless you're running Facebook or Twitter, the odds are that you don't really need to be asking questions like this. The bottlenecks you encounter are more likely to be poor code within your codebase than anything intrinsic about the language.

If you are running a site like Facebook that needs to scale beyond what that platform can realistically cope with, and your codebase is perfect and can't be made any faster, then it may be more feasible to do what Facebook did with PHP and fix the platform, rather than to switch to something different as that would involve rewriting your entire codebase, at which point you no longer have "perfect" code any more, and you lose the benefits of your dev team's existing skillset.

But very few of us are ever going to be in that position. Facebook did what the needed to do given the circumstances, but the rest of us should just concentrate on improving our own code before criticising the platform we're using.

Bottom line: If you write decent code, it doesn't matter what language it's in; all the major platforms are perfectly capable of running a high traffic web site. Conversely badly written code can and will bring even the most resiliant of servers to its knees. It's all about your code, not about the platform.

Anyone who tells you otherwise and says "language X isn't capable of doing that" is being a language snob. Feel free to ignore them.

Which one is the bigger security threat? (1, Redundant)

crazyjj (2598719) | about 2 years ago | (#42616429)

It would seem that the U.S. Dept. of Homeland Security are C# fans.

Re:Which one is the bigger security threat? (4, Informative)

clark0r (925569) | about 2 years ago | (#42616473)

This would be the browser plugin you're talking about? Websites are not served up by browser plugins. Stop spreading lies.

Re:Which one is the bigger security threat? (1)

Anonymous Coward | about 2 years ago | (#42616505)

If they were concerned about security, they wouldn't use windows on a server.

Aspects... (1)

Anonymous Coward | about 2 years ago | (#42616431)

What aspects of a language matter to you and how do you weigh them?

Re:Aspects... (1)

squiggleslash (241428) | about 2 years ago | (#42616865)

Read that sideways and you have an interesting way to evaluate programming languages. Write equivalent, readable, code in the languages you're evaluating.

Now print out each example, and weigh it. The one that weighs least is probably written in the programming language to use.

neither (-1)

Anonymous Coward | about 2 years ago | (#42616433)

neither

They are both as good (5, Insightful)

hsmith (818216) | about 2 years ago | (#42616441)

As your worst developer on the team.

I've used both and really haven't seen issue with either. I have a slight preference for C#, personally, but it all comes down to your design, architecture, and implementation that will slow you down.

Re:They are both as good (2)

Threni (635302) | about 2 years ago | (#42616539)

And whether you prefer Visual Studio's IDE, or Eclipse.

Re:They are both as good (2, Funny)

teknopurge (199509) | about 2 years ago | (#42616927)

Netbeans - Eclipse sucks.


So does emacs. (vi!!!!)


something something something LAWN!

Re:They are both as good (2)

MacGyver2210 (1053110) | about 2 years ago | (#42616975)

Eclipse is much more user-friendly and stable than NetBeans in every iteration I have used it.

Re:They are both as good (1)

AwesomeMcgee (2437070) | about 2 years ago | (#42616877)

... that will slow your down.

and eventually kill you! Muahaha! I mean, what?

Does it matter. (5, Insightful)

Anonymous Coward | about 2 years ago | (#42616449)

I personally would expect one to win in some regards and the other to win in others. My concern is that C# is too tightly bound to MS platforms. Java isn't perfect, it isn't the write once run everywhere that was promised, but the port from Java on MS to Java on Linux, Mac ... will most certainly be better.

That is enough that I would prefer Java over C# on my projects. Of course there are always outside parameters that might be enough to tip the scale.

Re:Does it matter. (5, Interesting)

i kan reed (749298) | about 2 years ago | (#42616993)

On the other hand, C#'s syntax has ruined java for me. Many simple tasks in java feel like they take 3 times as many steps as they need to: e.g. overloading a method with an optional bool defaulting to false requires actually writing a new overload and passing the default. To be fair, there are times when python or a functional language makes C# feel the same way, but java is just too far removed on the convenience factor for me.

Re:Does it matter. (5, Insightful)

hsmith (818216) | about 2 years ago | (#42617053)

I'll give it to MS, they have moved the language forward. Linq is amazing. Oracle has just isn't pushing forward as MS has done.

Re:Does it matter. (0)

Anonymous Coward | about 2 years ago | (#42617073)

You chose Java. Do you prefer back doors [slashdot.org] ?

C# has T4 templates [hanselman.com] that allow you to use C# to write C# code. Think about that with regard to LINQ, database model generation, and reflection. It's very powerful if you install intellisense support [microsoft.com] . Without that, you'll go insane because it's hard to otherwise make sense of where the generated code starts and your template ends.

Useless (0, Redundant)

funwithBSD (245349) | about 2 years ago | (#42616457)

What a useless test.

Tells you nothing about what is suitable for your requirements.

Java is best for malware (-1)

Anonymous Coward | about 2 years ago | (#42616469)

Write once and it works everywhere!

And then when they "fix it" it's really not fixed, because the spooks don't want it fixed.

Who could want anything more?

Question (1)

Anonymous Coward | about 2 years ago | (#42616471)

Why is it so hard to write a summary nowadays? The point of the summary is not to hide information, the purpose is to provide the information so readers don't have to search it.

Here is the result, right at the end of TFA: "Java is the clear winner here."

Re:Question (2)

doti (966971) | about 2 years ago | (#42616711)

It's a trap to try and make us look at TFA.

A question? (3, Insightful)

Coisiche (2000870) | about 2 years ago | (#42616483)

I have seen it often said that when a slashdot headline ends in a question mark then the answer is no.

Re:A question? (2, Funny)

Anonymous Coward | about 2 years ago | (#42616573)

I have seen it often said that when a slashdot headline ends in a question mark then the answer is no.

Maybe I should create a programming language, call it "no", and then submit a Slashdot story "What is the best programming language around?" :-)

Re:A question? (0)

Anonymous Coward | about 2 years ago | (#42617085)

What does "No" mean to the question "Which performs better in the real world?"?

they're both shit n/t (-1)

Anonymous Coward | about 2 years ago | (#42616485)

nt

Useless? (0)

Anonymous Coward | about 2 years ago | (#42616487)

Both runtimes are very heavily optimized, if you need something to run fast, either will work very well for you assuming you code it well and use appropriate libraries/frameworks. As compared to (non-native) Ruby/Python for example which can run code far slower - the JVM and CLR are much more comparable to each other.

I don't really see the value of this guy implementing low-level HTTP stuff in a very naive manner - he's not using modern approches that have been around for a decade (NIO and such) - so the value of any conclusions is essentially worthless.

A much better site for comparing microbenchmarks (with all appropriate warnings attached) would be: http://benchmarksgame.alioth.debian.org/

Errors on big sites (1)

EmperorOfCanada (1332175) | about 2 years ago | (#42616489)

I used to see a fair number of errors(crashes) that were both java and .net on many huge sites. But now I primarily see errors from crashing java sites. That could be due to people dumping .net, .net cleaning itself up, or .net programmers getting better. Personally I don't use either (did years ago) but the huge number of errors that I would see on what should have been well developed sites is what kept me away going back to either.

Now on smaller sites I see PHP crashes but I would expect to see more people using PHP on smaller sites and more people using it badly.

What I would love is a survey from say google showing what technologies are used on sites getting 1,000,000+ hits per day and what their error rate is?

source: experience (2, Informative)

tehlinux (896034) | about 2 years ago | (#42616491)

C# programmers get paid more.

real world (0)

Anonymous Coward | about 2 years ago | (#42616503)

did anyone notice that this test uses a very carefully crafted test environment? isn't that the opposite of a real-world test?

Android uses Java, at least Dalvik java (1, Interesting)

Anonymous Coward | about 2 years ago | (#42616523)

Windows 8 Metro doesn't use .NET.

Cheap dig aside, you tested Java by using a C# client, so actually what you tested was C# to C# and C# to Java and concluded that C# to C# makes a lot faster connections.

I can also save you the time and tell you Java on Windows machines is a complete dog, and on Ubuntu, it's a lot faster for the same hardware. So if you tested Java on Windows and concluded it was a dog, well yes it is, why is that?

Re:Android uses Java, at least Dalvik java (1)

Coisiche (2000870) | about 2 years ago | (#42616581)

The last line of the article I read was...

Meanwhile, Java is the clear winner here.

...or did I miss a link?

Not on his connection test (0)

Anonymous Coward | about 2 years ago | (#42616785)

He gave appalling numbers on his connection test which hasn't been my experience. So I'm curious why his connection test is so out of wack. Tomcat config perhaps?

However I take back his C# to Java test, he says he repeated it on Java to Java and got similar results, (but no numbers).

Re:Android uses Java, at least Dalvik java (4, Insightful)

squiggleslash (241428) | about 2 years ago | (#42617001)

* Dalvik is not Java. While the Java programming language is available for Dalvik, together with a subset of the J2SE library, the runtime itself is unrelated.
* Windows 8 Metro "does not use .NET" is kinda meaningless, neither does Win32. However, you certainly can build Metro apps in .NET. http://blogs.msdn.com/b/dotnet/archive/2012/04/17/net-for-metro-style-apps.aspx [msdn.com]
* The comment about the author of the article testing Java "by using a C# client" is bizarre and misleading. A language had to be picked, with the choice having the same impact on both tests. Chosing to test a Java server with a Java client, and then a C# server with a C# client would cause the test to be different in both situations and render the test results invalid.
* The author of the article concluded that Java was generally faster than C#, not that "it was a dog".
* Other than that, your comment is completely 100% correct. Possibly. Or maybe I didn't check.

no real world usage for this article... (0)

Anonymous Coward | about 2 years ago | (#42616525)

... if the author makes the stupid assumption that Java and .NET are useful to build web pages only.

Just do it all in C++ (5, Informative)

scorp1us (235526) | about 2 years ago | (#42616531)

Before I get modded troll, I'd like to point out that there is a really awesome C++ toolkit for web development and it will blow your mind. It's called Wt and it makes your applications fully OOP and a joy to develop in. One really awesome feature is that it is Boosted and another awesome feature is smart with regard to data. It will use where apropriate (usually you use the AJAX version of a control or mark a function for export to javascript) AJAX rather than statically filling your page. The result are some really easy to code fast websites.

Re:Just do it all in C++ (0, Troll)

Anonymous Coward | about 2 years ago | (#42616739)

Sounds great, except it is in C++...

Re:Just do it all in C++ (1)

Anonymous Coward | about 2 years ago | (#42617033)

I don't get why the criminally idiotic mods here actually marked your post a troll post. It's still much more useful than the original post to me at least. Unless there's just a joke I don't know enough to spot it yet, I'll check out Wt.

Re:Just do it all in C++ (2, Funny)

Anonymous Coward | about 2 years ago | (#42617115)

In response to the trolling:

C#/Java Fanboy Defense Force, assemble!!

Apples or Oranges which ones better? (1)

Edzor (744072) | about 2 years ago | (#42616551)

The scenarios you put forward as metrics are far too wide in scope to be any use. so Apples or Oranges which one is better?

Re:Apples or Oranges which ones better? (0)

Anonymous Coward | about 2 years ago | (#42616723)

And you just totally blew off bananas, which would have performed totally better in all cases.

These tests were also simple (5, Insightful)

ranton (36917) | about 2 years ago | (#42616559)

These tests were also just as simple as calculating Pi a thousand times. Based on the description, I was hoping for some tests where a website with a dozen or so complete views with significant bindings were created in both Java and C#. Instead it was just an HTTP request or a page that printed the date.

Different frameworks and web servers are going to use varying amounts of overhead, so simple tests really only calculate that overhead. If you are going to provide benchmarks that actually have some meaning then they need to test complex enough behavior to mimic real world usage.

These tests basically just show that Tomcat is faster than IIS for simple scenarios, or perhaps that ASP.NET MVC 4 adds more overhead to page requests than JSP does. Whether this overhead is meaningful when you are processing rich real world web pages is not covered by these tests.

Re:These tests were also simple (0)

Anonymous Coward | about 2 years ago | (#42617113)

These tests were also just as simple as calculating Pi a thousand times. Based on the description, I was hoping for some tests where a website with a dozen or so complete views with significant bindings were created in both Java and C#. Instead it was just an HTTP request or a page that printed the date.

So, get cracking. What's stopping you from doing the test yourself and publish the results?

The sad thing about it is that if you actually did some work, some other idiot would complain that your test was dissapointing, and that he was expecting more.

"Real world"... (0)

Anonymous Coward | about 2 years ago | (#42616569)

...for web servers means including benchmarks for pages with back-end database interaction.

Nobody is going to pay anyone for either Java or C# for pages which merely serve up static content.

Summary of TFA (1)

jez9999 (618189) | about 2 years ago | (#42616589)

C#/CLR is much quicker when directly responding to HTTP requests; Java/JVM is a bit quicker when going through the popular web servers / stacks Tomcat and IIS.

Which is better bad or worse? (2)

silas_moeckel (234313) | about 2 years ago | (#42616599)

The question is would you like to be hung or firing squad neither of them is very good.

Re:Which is better bad or worse? (3, Informative)

clark0r (925569) | about 2 years ago | (#42616643)

it's "hanged".

Re:Which is better bad or worse? (2)

binarylarry (1338699) | about 2 years ago | (#42616675)

I'd totally like to be hung.

Re:Which is better bad or worse? (2)

Coisiche (2000870) | about 2 years ago | (#42616789)

I think that statement requires additional qualification.

The colloquial extremes I have heard are "well hung" and "hung like a budgie".

If you want sheer performance.... (2)

prasadsurve (665770) | about 2 years ago | (#42616609)

C is the clear winner. Maybe that why its 1 number in TIOBE Programming Community Index [tiobe.com]

However choice of programming language has a lot to do with what you want to do.
If you want to create jobs to processing millions of records locally, C/C++ would be better.
If you want to have secure web based jobs, Java would be better.
If you want to create Windows GUI applications, C# would be better.

Basically its horses for courses.

Nothing to see here (5, Insightful)

MojoRilla (591502) | about 2 years ago | (#42616625)

This article was obviously written by someone who has no idea what the state of the art is in performance web serving. If you know anything about high scale web technology, skip it.

Where to start complaining? Don't roll your own http server. You probably don't understand what you are doing, and you will get weird results. Using Windows as a platform for a java web server is pretty silly. The author incorrectly assumes that because the .Net framework is fast, the ASP.net framework will be. That isn't the case. Running load testing on hello world test cases is silly. If you are interested in the real world, try testing with real world applications. The author also doesn't seem to understand that the JVM or .Net runtime will compile bytecode using JiT methods (Just in Time compiling). Finally, if you have skilled developers, it doesn't really matter what language you use. Architectural issues like data storage and caching are much more important than language.

Re:Nothing to see here (0)

Anonymous Coward | about 2 years ago | (#42616793)

You failed to read the part where he specifically tested Java on Linux and it performed slower. The only thing the article points out that IIS is bloated & slow.

And finally, yes it does matter, because there's no such thing as magic. If you force your team to use a bloated or buggy toolset, there's nothing they can do to optimize past it. If anything it shows you wasted company resources because you could have used (cheaper) junior level programmers and got similar performance.

Re:Nothing to see here (0)

Anonymous Coward | about 2 years ago | (#42616969)

He tested it on a shared instance remotely vs a dedicated computer where he was running the tests. He should be dual booting to linux using the same hardware if he wants to do any sort of comparison.

Summary: (5, Informative)

140Mandak262Jamuna (970587) | about 2 years ago | (#42616635)

Test 1: a low level function, usually done by the http server, is written by the user in java and c#. C# beats java handsdown.

Test 2: A function to generate a "full web site", (actually a simple web page with all the elements and trivial content). Java beats C# hands down.

Conclusion:

1. The testing guy has absolutely no idea of how to write low level function efficiently.

2. The testing guy's idea of a "full web site" is woe fully inadequate. He could have been the guy designing "full continental breakfast" in Roach Motel Inc.

Re:Summary: (1)

Anonymous Coward | about 2 years ago | (#42616995)

It seems the 'Real World' is the MTV version.

Re:Summary: (0)

Anonymous Coward | about 2 years ago | (#42617159)

So, where are your benchmark tests? Can I see them? Because I guarantee you that whatever test code you churn out, some other idiot will chime in accusing you of having absolutely no idea of how to write that stuff.

You can be either constructive, and present a better test made by yourself, or you can be a whiner, and complain that others actually did something useful while you failed to do just the same.

I don't like the premise. (3, Insightful)

Virtucon (127420) | about 2 years ago | (#42616681)

"Real World?" If we're all not in the real world then we must be living in imaginary space then. Seriously, I see the C#/Java thing coming down to a matter of enterprise choice vs. performance of the language. You'll find big shops running WebSphere/Weblogic and those running JBoss to deploy enterprise apps. There's still a lot of folks deploying with tomcat, which is a great tool. Microsoft has done well over the past few years in improving IIS / .NET scalability where it now can compete with Java EE deployments. 5 years ago you couldn't say that but now the differences are becoming more narrow. I like Java and use it. I like C# and use it as well. My biggest concerns with both is that largely, they're in the hands of two very large vendors. Java has at least more open push on it but again, Larry Ellison will dictate largely what happens to Java and IMO he'll milk it for every penny he can get. C#/.NET not only sells OS licenses for MSFT but it also gets used as a toy as well.
It would be really nice I guess if both of these were truly in the public domain as to prohibit Oracle and MSFT from having direct control over how the languages evolve and are licensed.

c# vs java (1)

smillie (30605) | about 2 years ago | (#42616699)

I thought the main reason to use java was to be OS independent. When your web page on Linux couldn't handle the load you could just move your code to a bigger Solaris or IBM box. Or when the PHB says he doesn't trust BSD to be secure he can move it all to Windows.

I've not worked with c#. Is it multiplatform like java or are you stuck with running it on Windows?

Re:c# vs java (1, Flamebait)

binarylarry (1338699) | about 2 years ago | (#42616827)

You're stuck using windows with C# and web development. ASP.net is not part of the .NET standard, there's been some attempts by the Mono people to clone it but it's not remotely production ready.

Java is open source and cross platform. .NET is closed source and runs only on Microsoft platforms.

Java is open source... really? (2)

JcMorin (930466) | about 2 years ago | (#42617083)

Really? Why do Oracle claim ownership of the code and even the api to company like Google? Threatering everyone who implement their variant of Java? On the other hand most of the C# library have been release the source code and the language is itself fully approved by EMCA and ISO (check wikipedia for reference), something Java is not (Because Java lacks any formal standardization recognized by Ecma International, ISO/IEC, ANSI, or other third-party standards organization, the Oracle implementation is the de facto standard.). .NET doesn't run only on Windows, Mono is project that exist for a while and it's use in many context. You can developer even application for Andriod phone in C#, because the language is open, you are welcome to make a compiler and re-use it everywhere!

Useless benchmark (0)

Anonymous Coward | about 2 years ago | (#42616709)

There's no mention of how he did JVM warmup. These benchmarks probably just indicate speed that the JVM and C# runtimes can interpret byte code, which is a very bad measure of performance in production. Also, mention of tuning anything in the runtimes, etc.

Re:Useless benchmark (2)

godefroi (52421) | about 2 years ago | (#42617003)

The C# runtime doesn't interpret bytecode. It's all JITted before execution. Always.

This is dumb. (0)

Anonymous Coward | about 2 years ago | (#42616719)

The smith makes the tools, the tools do not make the smith.

Terrible story...wtf editors? (1)

bobcat7677 (561727) | about 2 years ago | (#42616747)

The tests the author does not even close to a "real world" scenario. The conclusions drawn are meaningless and the article poorly written. I want the time I spent reading it back!

WOW (-1)

Anonymous Coward | about 2 years ago | (#42616753)

Java vs. C#? Talk about moron vs. moron.

Not real-world performance, this (0)

Anonymous Coward | about 2 years ago | (#42616763)

I wouldn't consider timing a few thousand requests from one client during at most a few seconds to be representative for real-world performance.

Also, the author attributes the speed-up he sees when he repeats the test in the Java setup to optimizations done by Tomcat. It may have been the hotspot compiler being done optimizing, and the word cache doesn't appear anywhere in the article.

I've seen enough Java programmers looking down on .NET and vice versa based on nothing more than prejudice, and it's always nice to see someone who apparently is part of that divide recognise the other side may have merits. But as a benchmark it's not very useful. I've done enough similar small tests myself, but I've always recognized how limited they are and never felt it was important enough to publish an article about it.

Java HttpServer class (1)

mypalmike (454265) | about 2 years ago | (#42616773)

I assume the Java HttpServer class used is the one that is bundled with the Sun version of the JVM. This class is not officially part of the JDK and is known to be slow. I am definitely curious about the insanely slow speeds he found. Anyhow, most Java developers who want to embed an http server would turn to Grizzly.

are they serious right now? (-1, Flamebait)

slashmydots (2189826) | about 2 years ago | (#42616791)

C# is faster. Java is one of the slowest things I've ever seen in my life. All that "we run on any OS" overhead is ridiculous. How are they even asking this?! Java games run like crap. Open Office is slow as hell. Fishbowl is slow as hell and takes 4x more memory than it should. Java is super inefficient at the cost of being compatible. C# runs a lot closer to natively on any OS.

Re:are they serious right now? (1)

jasmusic (786052) | about 2 years ago | (#42617155)

I've run in-process game bots in C# and the effect on frame rate was negligible or zero. C# is industrial strength, you can use it for anything. In fact the next official MS C# compiler is written in C#, plus Exchange Server is written in C#.

Article missing configuration details (0)

Anonymous Coward | about 2 years ago | (#42616797)

As a developer who has been working on Java, J(2)EE apps for well over a decade, I know that the configuration of the JVM and of Tomcat (or other application servers) makes quite a bit of difference on an application's performance. C# and Java are both likely good choices, but the comparison in the article was FAR too simplistic to have any relevant meaning.

For Tomcat, tuning the number of threads used for processing requests, accept counts, etc. is absolutely necessary. Also, the author did not specify how his database was configured, ie. the maximum number of connections, memory, and so on. If you configure a large number of concurrent requests in Tomcat, where each request fetches data from the database, you may have many threads blocking while waiting on a connection from the database pool. And we haven't even started in on the real-world tools like Hibernate and its caching capabilities.

JVM parameters are also essential to get right. If you don't assign the JVM enough heap space, or if you don't select the right garbage collection settings, you're setting yourself up for trouble.

Also the comparison of JSP v. servlet is total nonsense. JSP's are compiled first into a servlet, which is then compiled to a class file - the only difference versus a servlet is that the servlet is precompiled to a class file prior to deployment. So the first request to the JSP will obviously take a bit longer, but then the time to serve pages should stabilize.

Another terrible SlashBI crap post (1)

Bill, Shooter of Bul (629286) | about 2 years ago | (#42616803)

No graphics, no rigor in method, terrible writing. Dice needs to slap slashdot upside the head to kill these off. They're actually worse than the bitcoin stories.

Tests don't really tell us anything (1)

Tridus (79566) | about 2 years ago | (#42616839)

The actual test for a web platform is more along the lines of "how many simultaneous requests can this handle while still giving acceptable performance?" It doesn't matter if one of them can deliver one webpage 10ms faster than the other if it's going to fall apart at 50 requests.

It's kind of interesting for academic curiousity that Java's HttpServer class is that awful, but these tests don't tell you anything about real world performance.

Batman (1)

Anonymous Coward | about 2 years ago | (#42616891)

It's like arguing over whether Batman is a Technologist or a Scientist.

Re:Batman (0, Troll)

Anonymous Coward | about 2 years ago | (#42617007)

I've had that argument before. We agreed Batman is a Pedophile and left it at that.

Real World? (1)

ZeroSerenity (923363) | about 2 years ago | (#42616921)

"But the reality is, almost nobody actually writes a low-level HTTP listener; instead, they tend to use existing HTTP servers."

Which is the point where I stopped reading since it obviously wasn't real world by his own admission.

Microsoft: Make everything magic with reflection (0)

earlzdotnet (2788729) | about 2 years ago | (#42616931)

This is definitely an apple to oranges comparison as far as the CLR vs JVM because you're not just comparing them. You're also comparing IIS/Apache and MVC/whatever java has performance.

I suspect that one of the major reasons for C# being slower though is because Microsoft insists on making everything very magical and very fragily tied together with reflection. Why are views not compiled at compile time? No one knows. Why is reflection required to hook views to models to controllers? "because it's cool". Microsoft tries to make their statically typed language work with a pseudo-dynamically typed framework, and it ends up having crap performance(out of the box) as a result

I actually made an alternative framework("BarelyMVC") because of this. In my framework, I use reflection magic only once, and only because doing it manually is difficult, has no benefit, and has a marginal performance impact. I have staticly compiled views that have nearly no performance impact(it's just string concatenation). My routing engine doesn't rely on transversing folders and searching for specially named classes with attributes, you pass in a lambda to get the model/controller you need. I don't rely on magical attributes and naming schemes for core functionality. Now, of course, my framework isn't as "pretty", but when debugging time comes, it's very clear how everything is connected.

What a bunch of... words. (2)

jbssm (961115) | about 2 years ago | (#42616943)

Graphs and charts, that brilliant and extremely high demanding tech from the XV century, that still didn't manage to be available to author of the study.

Java (1)

Megane (129182) | about 2 years ago | (#42616947)

Because when your operating system doesn't come from Microsoft, you can "See Pound Salt" when trying to run C# code.

wall clock time is meaningless (0)

Anonymous Coward | about 2 years ago | (#42617005)

The issue with this article -- can't use wall clock time for performance testing. Author needs to monitor CPU time.

About the same (0)

Anonymous Coward | about 2 years ago | (#42617035)

In terms of real world performance, C# may be the best (on windows). However, Java and C# are both managed hybrid languages (partly compiled partly interpreted). So in theory the two languages are probably about the same. If you really want to test them out then I'd try a profiler, and see how the code stacks up. I personally stray away from anything .net because it is not well supported on non-windows platforms. However, java has been found to have some serious security holes as of late as well. When planning for the future it's unlikely that you will be able to see how they will be performing a year from now. HTML5, with javascript, and PHP may still be the way to go.

Choosing a Language (5, Insightful)

RedHackTea (2779623) | about 2 years ago | (#42617059)

Today, most of (if not all) the reasons for choosing a language are subjective instead of objective (not objective-c). Languages are so similar (at least the fundamentals, not talking about Brainfuck-lang here) that you pick a language based on the platform it targets or just personal feelings.

In short, the Microsoft fanboys avoid more Linux-favored languages (and don't even think about Apple languages); Apple fanboys avoid more Microsoft-favored languages; and Linux fanboys avoid more patent-encumbered, closed-source languages and ones requiring to purchase an IDE/etc. for development. All fanboys avoid what they perceive as "diseased languages" like the plague. However, they will still touch these diseased language every now and then because either they have to for a job or out of pure curiosity.

Being a Linux fanboy, C# is my bubonic plague. This is also in part growing up using Microsoft Visual Studio 6 for C++. For the haters, I actually loved this IDE, but then I found out that none of my code would work on other platforms or even other compilers with Win32 such as Borland++, g++, etc. (we all remember how a variable in a for-loop wouldn't be contained to just that block... terrible). And then when exploring other languages/environments, I couldn't believe my eyes when I could actually see library-level source code -- you have no idea how useful this is. Even though I'll admit that Microsoft has gotten a little better about this (although they still tried to spread FUD using the DroidRage campaign), it's not worth it to me. They've already lost my faith in them as a customer, and I can't see myself ever returning.

Now, a good study would be to remove all of this and determine what languages are either faster to code in, easier to debug/maintain/extend with enterprise-level code, or more readable. But would this study even be useful? The differences would be so minute. Scripting languages are going to be faster to code in, so what's the fastest scripting language to code in? Object-oriented languages will be the easiest to debug/maintain/extend. As for readability, who knows? It's so subjective. We'd have to get a large, random sample size of people that have never seen a programming language before.

Having said all of this, I still appreciate this guy doing the study. Apache has always made top-quality code, and it's good to see that TomCat lives up to it.

Finally, as for sheer speed (and needs to be at least easier than assembly), C will always win.

Server performance (1)

roman_mir (125474) | about 2 years ago | (#42617067)

Obviously the application architecture is the key in server side performance numbers. If we are going to go with anecdotes, like the ones in the story, I can provide some of my own data, which I will pull right now from a server running my system used to manage a retail chain. The installation doesn't use the latest and greatest, here is what it is:

The app server has 32GB RAM (my app is given 12GB), 2 x Intel Xeon Quad-Core E5405 2GHz CPUs.
Tomcat Apache 6.0.32, Apache/2.2.15 (Unix), SSL,
Fedora 11 (fc11.x86_64)

The DB server runs latest PostgreSQL, 48GB RAM, 1 x Intel Xeon Quad-Core E5504 2GHz, same OS

The firewall is a OpenBSD 4.5 (clearly needs an upgrade)
Celeron 2.80GHz with 1GB RAM (it does a few other things)

So, this is a real world situation, the system is used across retail chain stores, office management and suppliers.

(and apparently I cannot post a comment of the size that I wanted on /., 'request entity is too big' - that's Apache telling us that SSLRenegBufferSize is too small for my comment. Then, when I reduced the size of the comment enough, /. threw its ridiculous 'Lameness filter' at me, what's the point of having 'ecode' tags here?)

OK, so stats without the DB table printout:

out of 1031 requests for that chain in 8 working hours 2045 requests were processed. It's not a public website, so clearly magnitude is different.

298 requests took less than 10 milliseconds.
517 requests took 10 to 100 milliseconds.
741 requests took 100 to 500 milliseconds.
297 requests took 500 to 1 second
80 requests took 1 to 2 seconds
20 took 2 to 3 seconds
6 took 3 to 4 seconds
3 took 4 to 5 seconds
62 took 5 to 10 seconds
19 took 10 to 30 seconds
2 took 45 seconds.

That's considering that the data is compiled across 14 stores and across sales for variable time periods and variable categorisation of products. For example there are requests that span large categories of products (P&G vs Beiersdorf) across an entire fiscal year for all stores.

Unfortunately I don't have a C# management system to compare against.

Re:Server performance (0)

Anonymous Coward | about 2 years ago | (#42617093)

I should have previewed the comment, this sentence is borked:
"out of 1031 requests for that chain in 8 working hours 2045 requests were processed. It's not a public website, so clearly magnitude is different."
It should be just 2045 requests in 8 hours. 1031 is number of types of requests that can be processed.

Who cares? (2, Interesting)

characterZer0 (138196) | about 2 years ago | (#42617153)

So what if there is a 25% different in performance? Hardware is cheap. Software maintenance, administration, and licensing is expensive. The most compelling reason to use Java is that I can run it on Linux. That means I can clone VMs for development and testing, copy OS installations, and ship VMs to customers and resellers without having to spend time and money on licensing and activation. It makes development, testing, and deployment easier to automate when possible and hack when necessary for the small guys that don't have volume license agreements. .NET isn't the problem. Windows is.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?