简体   繁体   English

Java和tomcat vs ASP.NET和IIS

[英]Java and tomcat vs ASP.NET and IIS

Until recently I'd considered myself to be a pretty good web programmer (coming up for 10yrs commercial experience on a variety of e-commerce, static and enterprise applications). 直到最近,我才认为自己是一个非常优秀的网络程序员(在各种电子商务,静态和企业应用程序上提供10年的商业经验)。 I'm self taught and have always used the Microsoft product stack (ASP, ASP.NET)... 我是自学成才,并且一直使用Microsoft产品堆栈(ASP,ASP.NET)......

My applications are always functional, relatively bug free, but have never been lightening quick. 我的应用程序总是功能齐全,相对没有bug,但从来没有快速闪电。 As a frequent web user I always found this to be the norm... how fast are the websites from the big tech players (eBay, Facebook, Microsoft, IBM, Dell, Telerik etc etc) - in truth none are particularly fast. 作为一个频繁的网络用户,我总是发现这是常态......来自大型科​​技公司(eBay,Facebook,微软,IBM,戴尔,Telerik等)的网站有多快 - 实际上没有一个特别快。 I always attributed this to "the way things are with web apps"... 我总是把它归结为“网络应用程序的方式”......

...then I cam across a product called Jira from atlasian and this has stopped me in my tracks... ...然后我从地图集中了解了一个叫做Jira的产品,这让我陷入困境......

This application is fast, and I mean blindingly fast.. too fast to time the switches between pages, fully live content, lots of images and data and cross references etc etc... 这个应用程序很快,我的意思是快速...快速的时间切换页面之间的切换,完整的实时内容,大量的图像和数据和交叉引用等...

I run this on an intranet, with a large application DB, and this is running on a very normal server (single processor, SATA HDD, 8GB RAM). 我在具有大型应用程序数据库的Intranet上运行它,这是在非常普通的服务器上运行的(单处理器,SATA HDD,8GB RAM)。

Am I missing something?? 我错过了什么? Are my programming techniques that bad?? 我的编程技术是不是很糟糕? I am wondering if this speed gain is down to it being written in Java and running on Tomcat. 我想知道这个速度增益是否低于用Java编写并在Tomcat上运行。

Does anyone have any benchmarks to compare JSP / ASP or Tomcat / IIS??? 有没有人有任何基准来比较JSP / ASP或Tomcat / IIS ???

Thanks, Mark 谢谢,马克

NOTE: this isn't a blatant plug for Jira. 注意:这不是Jira的明显插件。 I don't work for them or have any affiliation to them... but I would like to be able to write applications like them :) 我不为他们工作或与他们有任何联系...但我希望能够编写像他们这样的应用程序:)

YMMV. 因人而异。 But one of the longest-lived Things That Aren't True Anymore is the assertion that "Java Is Slow". 但是,不再存在的最长寿的事情之一是“Java慢”的断言。 Excepting floating-point (where most Java implementations aren't at liberty to use the floating-point hardware), Java is generally as fast or faster than compiled code. 除了浮点(大多数Java实现不能自由使用浮点硬件),Java通常比编译代码快或快。 Some of the best and brightest have spent years of effort ensuring this, including such things as dynamic recompilation/re-optimization of code based on run-time metrics - something that statically-compiled languages like C or assembler cannot boast. 一些最优秀和最聪明的人花了多年的努力来确保这一点,包括基于运行时指标的动态重新编译/重新优化代码 - 这些静态编译的语言如C或汇编程序无法夸耀。

ASP is sort of the opposite extreme, since the original ASP had to recompile each page request each and every time it was made. ASP是一种相反的极端,因为最初的ASP必须每次都重新编译每个页面请求。 ASPX addressed this by allowing retention of the compiled page code. ASPX通过允许保留已编译的页面代码来解决这个问题。 That got rid of a lot of useless overhead. 这摆脱了很多无用的开销。

A more compelling reason to prefer Java over ASPanything/IIS is freedom. 更喜欢Java而不是ASPanything / IIS的更有说服力的理由是自由。 A Java/Tomcat webapp will run under almost any OS on almost any hardware. Java / Tomcat webapp几乎可以在任何硬件上的任何操作系统下运行。 IIS runs on Windows. IIS在Windows上运行。 Period. 期。 And for the most part, that also means Intel. 在大多数情况下,这也意味着英特尔。 Not Sparc, Not zSeries. 不是Sparc,不是zSeries。 Maybe you don't care. 也许你不在乎。 But then again, maybe next week IBM will offer your employer a can't-refuse deal on a mainframe. 但话说回来,也许下周IBM将为您的雇主提供一个不可拒绝的大型机交易。

I don't have benchmarks, and there are a lot of things that can make one platform preferable. 我没有基准测试,并且有很多东西可以使一个平台更受欢迎。 But I permanently gave up on the "Java is slow" idea when I encountered the Poseidon UML tool with its cool real-time graphics UI and the FreeMind mindmapper tool. 但是当我遇到Poseidon UML工具及其酷炫的实时图形用户界面和FreeMind思维导图工具时,我永远放弃了“Java慢”的想法。 A small hit to startup the JVM, but after that, you'd never know what language you were working under. 启动JVM是一个很小的打击,但在那之后,你永远不会知道你正在使用什么语言。

The great debate. 大辩论。 Java vs. .Net. Java与.Net。

When .Net first came out there was an application written called "The Pet Shop." 当.Net第一次出现时,有一个名为“The Pet Shop”的应用程序。 Which was a .Net port of Sun's J2EE reference application, "The Pet Store". 这是Sun的J2EE参考应用程序“The Pet Store”的.Net端口。 It was announced that Microsoft's implementation was "faster." 据宣布,微软的实施“更快”。

As with anything, especially anything to do with marketing, you have to dig deeper to find the truth. 与任何事情一样,特别是与营销有关的事情,你必须深入挖掘才能找到真相。

Any technology can be fast with enough hardware and the correct design. 任何技术都可以通过足够的硬件和正确的设计来实现。 In my experience there are two factors to speed: What type of hardware is used and how you architect your application (this includes database tuning). 根据我的经验,速度有两个因素:使用什么类型的硬件以及如何构建应用程序(包括数据库调优)。

Caching at various levels (response, db, etc.) makes a huge different in responsiveness of a web application. 各种级别的缓存(响应,数据库等)使Web应用程序的响应能力大不相同。 There is also a lot of things that are done to reduce time consuming operations like db connection pooling, sql statement caching, etc. As much as I'd like to say Java is better :-), I think in this case the performance is due to the way Jira was written and the fact that it's being run internally (probably with few users as compared to eBay, Facebook, Microsoft). 还有很多事情要做,以减少数据库连接池,sql语句缓存等耗时的操作。尽管我想说Java更好:-),我认为在这种情况下性能是由于Jira的编写方式以及它在内部运行的事实(与eBay,Facebook,Microsoft相比可能只有少数用户)。 This site, Stackoverflow, uses ASP.NET MVC and IIS and is very responsive and my guess (since code is not open sourced, yet) is that they use many of the same techniques you would find in Jira or any other web application built to scale. 这个站点,Stackoverflow,使用ASP.NET MVC和IIS,并且非常敏感,我的猜测(因为代码不是开源的),他们使用了许多你在Jira或任何其他Web应用程序中找到的相同技术。规模。

I think that it is not typically the frameworks and languages used that make an application slow. 我认为通常不会使用的框架和语言使应用程序变慢。 In my experience, some frameworks like JSF or .NET server side controls give developers alot of freedom to make too many database calls and look things up too often, but that's definitely not the fault of the framework used. 根据我的经验,一些框架如JSF或.NET服务器端控件为开发人员提供了很多自由来进行过多的数据库调用并经常查看,但这绝不是所用框架的错误。

Keep your application as light as possible and focus on keeping the data sent to the client as small as possible, and you will have a fast application. 保持应用程序尽可能轻松,并专注于尽可能减少发送给客户端的数据,您将拥有快速的应用程序。 It's usually faster to develop fast applications too. 开发快速应用程序通常也会更快。

The Jira folks have written a best in class application (and charge for it) - nice work crocodile dundees. Jira人写了一个最好的应用程序(并收取它) - 很好的工作鳄鱼dundees。

I also suggest to consider also two aspects: 我还建议考虑两个方面:

  • the maintenance activities: logging and deployment. 维护活动:记录和部署。 In my opinion under a unix like server is more easier to log, deploy, and maintain new release than doing the same on a Windows server. 在我看来,像unix这样的服务器比在Windows服务器上执行相同操作更容易记录,部署和维护新版本。
  • if the project require to use some open source application (ie Alfresco repository) Java is better solutions 如果项目需要使用一些开源应用程序(即Alfresco存储库),Java是更好的解决方案

People's opinion is mostly biased. 人们的意见大多是有偏见的。 Most people have never really tried the other while claiming the other is slower. 大多数人从未真正尝试过对方,而声称对方速度较慢。 I wouldn't trust any answer: it's mere opinion. 我不相信任何答案:这只是意见。 It's boring to always read the same 4 cents again and again. 总是一次又一次地阅读相同的4美分很无聊。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM