resin vs jetty
服務器:redhat as 4 2.6.9-22.ELsmp Intel(R) Pentium(R) D CPU 2.80GHz 2G記憶體 160G SATA 客戶機:WINXP SP2 Intel(R) Pentium(r) 4 CPU 2.93GHz 1G記憶體 80G IDE硬碟 測試軟體:Load Runner 7.8 並發用戶數: 500 測試代碼: <%@ page language=”java” import=”java.util.*” pageEncoding=”ISO-8859-1″%><%String path = request.getContextPath();String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”; HashMap m = new HashMap();for(int i=0;i<10000;i++) m.put(i,i);m.clear();m = null;%> <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”><html> <head> <base […]
jetty 使用手記
jetty resin tomcat 測試報告:http://www.strongd.net/blog/show/255 一直以來使用jetty作為我的web開發配置服務器,開始的時候和所有的初學者一様使用tomcat作為開發服務器,可用着用着,感覺tomcat越來越繁瑣以及龐大。後來,用了jboss,知道jboss使用jetty作為其web應用服務器,所以就開始試着使用jetty。從那開始後,jetty就成為我的開發配置服務器了,從最初的4.0,到現在的6.0一直在使用着。 喜歡jetty的原因,在于其的方便,簡單的配置文件,簡單的啓動脚本,而且在elipse或者其他ide中,進行調試,運行都很方便。 不想多説什麽,讓事實來説話吧。在開始之前,先下載jetty。目前最新的版本為6.1: http://docs.codehaus.org/display/JETTY/Downloading+and+Installing#download 以前的版本文件是比較小的,現在的版本增加了很多東東,主要是很多例子應用,以及源碼,經過删减只有,整個應用還是比較小的,大概也就10m多了。如果只是需要運行web應用,并且只是需要jsp 2.1規範的話,只有7m多了。以前4.0的時候只有2m多,現在也已經增加了那麽多了,時代在進步,没有辦法。 jetty主要的jar為jetty-6.1.1.jar,servlet-api-2.5-6.1.1.jar,jetty-util-6.1.1.jar。啓動的jar 為start.jar。還有jsp規範的jar。jsp2.1,好像已經减了不少的jar了,只有4個文件core-3.1.1.jar,ant-1.6.5.jar,jsp-2.1.jar,jsp-api-2.1.jar。core是使用eclipse的jdt,進行jsp編譯。 jetty的主要配置文件為etc/jetty.xml,當然你可以自己指定彆的文件。在start.jar中有個start.config文件是默認的環境配置,以及指定默認的配置文件。可以手工替换。 啓動jetty很簡單,在命令行下面java -jar start.jar 如果需要指定start.config,使用java -DSTART=start.config -jar start.jart 配置web 應用也非常的簡單: 更改jetty.xml就行了,增加web應用的方式包括,直接放置應用在webapps下面,或者配置以下的context <New id=”Mywork” class=”org.mortbay.jetty.webapp.WebAppContext”> <Arg><Ref id=”Contexts”/></Arg> <!– 絶對路徑,可以指定相對路徑,增加 <SystemProperty name=”jetty.home” default=”.”/> 就行–> <Arg>d:/workspace/strong/web/</Arg> <Arg>/mywork</Arg> <Set name=”defaultsDescriptor”><SystemProperty name=”jetty.home” default=”.”/>/etc/webdefault.xml</Set> <Set name=”virtualHosts”> <Array type=”java.lang.String”> <Item>www.strongd.net</Item> </Array> </Set> </New> 要想改變原先的webapps主應用,改變下面的配置 <Call class=”org.mortbay.jetty.webapp.WebAppContext” name=”addWebApplications”> <Arg><Ref id=”Contexts”/></Arg> <Arg><SystemProperty name=”jetty.home” default=”.”/>/webapps</Arg> <Arg><SystemProperty name=”jetty.home” default=”.”/>/etc/webdefault.xml</Arg> <Arg type=”boolean”>True</Arg> <!– extract –> <Arg type=”boolean”>False</Arg> <!– parent priority class loading –> </Call> 默認的web.xml配置文件為webdefault.xml如果想配置相應的web參數,可以更改其應用。默認的端口為8080,如果想修改,更改:jetty.port屬性 <Call name=”addConnector”> <Arg> <New class=”org.mortbay.jetty.nio.SelectChannelConnector”> <Set name=”port”><SystemProperty name=”jetty.port” default=”8080″/></Set> <Set name=”maxIdleTime”>30000</Set> <Set name=”Acceptors”>2</Set> <Set name=”confidentialPort”>8443</Set> </New> </Arg> </Call> 簡單的配置,簡單的啓動,下一篇,我會介紹,如何在eclipse中使用jetty.
Jetty vs. Tomcat vs. Resin: A Performance Comparison
This morning, I did some comparisons between Jetty 5.1.5rc1, Tomcat 5.5.9 and Resin 3.0.14 (OS version). I ran AppFuse’s “test-canoo” target, which tests all the JSPs using Canoo WebTest. I did this as a Servlet 2.4 application, and had to tweak some stuff in my web.xml to make it work on Jetty and Resin. Nothing […]
支援藍光燒錄機的免費燒錄軟體:AVS Disc Creator
軟體:AVS Disc Creator(版本:2.1.5.100)類別:燒錄程式性質:Freeware(5.6 M)【編輯/高啟唐】AVS Disc Creator是一個免費的光碟燒錄軟體,不但支援CD、DVD光碟燒錄機,就連最新的藍光燒錄機也都支援了,所用者完全不必擔心相容性上的問題。所有常用的燒錄功能,AVS Disc Creator可說是全具備了,像是資料光碟、影片光碟、MP3光碟與製作光碟映像檔等功能,AVS Disc Creator都可以燒錄,功能不比其他付費燒錄軟體遜色。另外,AVS Disc Creator還支援抹除可複寫式光碟與專案排程等燒錄輔助功能。還在煩惱找不到合用且免費的燒錄軟體嗎?建議你來試試AVS Disc Creator!下載:http://www.avsmedia.com/download/AVSDiscCreator.exe
Generate not repeat random numbers
for(int i=;i<100;i++){ ArrayList<Integer> tmp_l = new ArrayList<Integer>(); int pos = 100;int serial = (int)Math.round(Math.random()*(pos-1));int loopcontrol = 0; while(tmp_l.contains(serial)){ if(loopcontrol>100) break; serial = (int)Math.round(Math.random()*(pos-1)); loopcontrol ++;} tmp_l.add(serial); System.out.println(“The random number for “+i+” is:”+serial); } 只給出代碼片段, 先有機出一個數,保存在ArrayList,再有機第二個數,看看是否存在於ArrayList中,如果存在,再重新有機第二個數.如此類推..直到完成100個有機數為此!
支援多種格式的免費映像檔燒錄軟體:ImgBurn
隨著燒錄機的普及,網路上越來越多大型檔案都改以映像檔格式傳輸;不過映像檔下載回來後需要燒成光碟才能讀取,是否有支援多種格式而且還是免費的映像檔燒錄軟體呢?來試試ImgBurn吧!ImgBurn正是一套免費的映像檔燒錄軟體,它不但可以燒錄ISO、MDS、BIN、DI、DVD、GI、IMG、NRG、 PDI、CDI、CDR、GCM、IBQ、LST、VDI等市面上最常見的映像檔,還支援CD、DVD、HD DVD、Blu-ray諸多格式喔!除了能燒錄映像檔,ImgBurn還具備製作映像檔的功能,雖然只能製作ISO格式,但比起一堆需付費的同類型軟體已經強太多了!而ImgBurn的介面簡明易懂,體積小不會佔用太多電腦資源,對於有燒錄映像檔需求的人來說,絕對是不可多得的好幫手! 下载地址: http://download.imgburn.com/SetupImgBurn_2.3.2.0.exe
Speeding up Linux Using hdparm
Are you running an Intel Linux system with at least one (E)IDE hard drive?Wouldn’t it be neat if there were a magical command to instantly double the I/O performance of your disks? Or, in some cases, show 6 to 10 times your existing throughput?Did you ever just wonder how to tell what kind of performance […]
Beyond Preferences API Basics
The Preferences API was first covered here shortly after it was introduced with the 1.4 version of the standard platform: the July 15, 2003 article, the Preferences API. That article described how to get and set user specific preferences. There is more to the Preferences API than just getting and setting user specific settings. There […]
Using Enhanced For-Loops with Your Classes
The enhanced for-loop is a popular feature introduced with the Java SE platform in version 5.0. Its simple structure allows one to simplify code by presenting for-loops that visit each element of an array/collection without explicitly expressing how one goes from element to element. Because the old style of coding didn’t become invalid with the […]
The For-Each Loop
Iterating over a collection is uglier than it needs to be. Consider the following method, which takes a collection of timer tasks and cancels them: void cancelAll(Collection<TimerTask> c) { for (Iterator<TimerTask> i = c.iterator(); i.hasNext(); ) i.next().cancel(); } The iterator is just clutter. Furthermore, it is an opportunity for error. The iterator variable occurs […]