畢業(yè)設(shè)計外文資料翻譯-PHP和JSP作為服務(wù)器腳本語言的性能比較_第1頁
畢業(yè)設(shè)計外文資料翻譯-PHP和JSP作為服務(wù)器腳本語言的性能比較_第2頁
畢業(yè)設(shè)計外文資料翻譯-PHP和JSP作為服務(wù)器腳本語言的性能比較_第3頁
畢業(yè)設(shè)計外文資料翻譯-PHP和JSP作為服務(wù)器腳本語言的性能比較_第4頁
畢業(yè)設(shè)計外文資料翻譯-PHP和JSP作為服務(wù)器腳本語言的性能比較_第5頁
已閱讀5頁,還剩10頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、畢業(yè)設(shè)計外文資料翻譯學(xué) 院: 專業(yè)班級: 學(xué)生姓名: 學(xué) 號: 指導(dǎo)教師: 外文出處:書名:Springer Berlin Heidelberg 頁碼:164-182 作者:S Trent,M Tatsubori,T Suzumura 附 件:1.外文資料翻譯譯文; 2.外文原文 指導(dǎo)教師評語:該英文資料選擇合理,與畢業(yè)設(shè)計報告相關(guān)度比較高。專業(yè)術(shù)語、詞匯翻譯的準(zhǔn)確度達(dá)到要求,體現(xiàn)了較高的專業(yè)英語應(yīng)用水平。外文翻譯與研究課題關(guān)系密切,翻譯工作能夠嚴(yán)格按照規(guī)定,達(dá)到考核、提高學(xué)生英語應(yīng)用水平的目的,完成要求。 簽名: 2015年 10月14日1外文資料翻譯譯文PHP和JSP作為服務(wù)器腳本語言的性

2、能比較摘要 動態(tài)腳本語言PHP已經(jīng)成為實現(xiàn)輕量級的Web應(yīng)用程序非常受歡迎,被廣泛用作服務(wù)器端腳本語言的Web服務(wù)器。對比PHP和JSP的性能,為此,我們使用SPECweb2005基準(zhǔn),它提供了PHP和JSP實施了三個應(yīng)用場景。本文介紹和對比上采用了時下流行的Web服務(wù)器Apache和PHP的Lighttpd和JSP的不同配置進(jìn)行SPECweb2005性能基準(zhǔn)測試的結(jié)果。盡管在微基準(zhǔn)測試發(fā)現(xiàn)PHP引擎解釋執(zhí)行開銷,SPECweb2005基準(zhǔn)的實驗結(jié)果得到了Web服務(wù)器的實施者有價值的性能數(shù)據(jù)。腳本語言運行時的效率仍然重要的終端到終端的性能。然而,一次精心架構(gòu)和調(diào)整,語言運行時少的瓶頸不是Web

3、服務(wù)器的性能本身。關(guān)鍵詞:PHP,JSP,SPECweb,標(biāo)桿,Web服務(wù)器。1簡介動態(tài)腳本語言PHP(PHP超文本預(yù)處理器)已經(jīng)成為非常流行的輕量級Web執(zhí)行應(yīng)用程序,并廣泛用于訪問數(shù)據(jù)庫和其他中間件。2007年10月流行的Apache模塊安全空間進(jìn)行的調(diào)查表明,37%的Apache服務(wù)器支持PHP功能,以10個百分點使它成為最流行的Apache模塊。企業(yè)正迅速實現(xiàn)與動態(tài)腳本語言,如PHP的面向服務(wù)的體系結(jié)構(gòu)環(huán)境的強(qiáng)大組合。然而,我們相信仍然有重要的性能問題涉及到PHP,它仍有待于被調(diào)查。本文重點介紹了動態(tài)腳本語言的使用來實現(xiàn)Web服務(wù)器的前端接口。與此對應(yīng)的方式,該行業(yè)標(biāo)準(zhǔn)的Web服務(wù)器性

4、能的基準(zhǔn)SPECweb2005利用PHP和JSP(JavaServer頁面)。在這種情況下,腳本是用于執(zhí)行動態(tài)頁面生成,而不是復(fù)雜的業(yè)務(wù)邏輯的實現(xiàn)。與此相反的傳統(tǒng)用途是基于JSP的復(fù)雜的業(yè)務(wù)邏輯實現(xiàn)。雖然有許多動態(tài)網(wǎng)頁內(nèi)容的研究,本文補(bǔ)充了這些研究的詳細(xì)分析,重點在于PHP中。例如,下面就CGI(通用網(wǎng)關(guān)接口)基于Web服務(wù)器的動態(tài)內(nèi)容由耶格爾麥格拉思可追溯到1995年的性能研究,研究人員和從業(yè)者一直在研究最近的動態(tài)的WebContent技術(shù)性能。這些作品,然而,處理應(yīng)用程序方案在servlet前端實現(xiàn)相對復(fù)雜的業(yè)務(wù)邏輯。雖然華納和沃利也使用PHP與SPECweb2005,以作者所知的重要性,

5、本文是首次發(fā)布了使用PHP和JSP的SPECweb2005實驗結(jié)果的詳細(xì)分析。PHP和JSP的性能的詳細(xì)分析是基于本文件所提供的SPECweb2005,使設(shè)計者和實施者了解Web服務(wù)器的相對性能,并通過把不同版本的PHP和JSP進(jìn)行配置。2多層Web服務(wù)器架構(gòu):使用PHP/JSP的輕量級前端開發(fā)人員通常使用PHP來實現(xiàn)一個生成動態(tài)Web內(nèi)容的前端界面,這與Web服務(wù)器軟件和后端服務(wù)器相結(jié)合,提供動態(tài)內(nèi)容。該網(wǎng)站的服務(wù)器直接處理靜態(tài)內(nèi)容并轉(zhuǎn)發(fā)請求動態(tài)內(nèi)容生成動態(tài)內(nèi)容。后端服務(wù)器支持動態(tài)內(nèi)容生成,執(zhí)行代碼來實現(xiàn)一個網(wǎng)站和商店的動態(tài)狀態(tài)的業(yè)務(wù)邏輯。后端服務(wù)器可以作為一個直接的數(shù)據(jù)庫來實現(xiàn),或者可能更

6、復(fù)雜的服務(wù)器處理該網(wǎng)站的業(yè)務(wù)邏輯。前端的執(zhí)行可能有所不同于重量級的業(yè)務(wù)邏輯程序來處理從后端服務(wù)器接收輕量級客戶端的內(nèi)容。本文重點介紹多層Web站點開發(fā)利用這種由一個或多個重量級后端層支持輕量級的前端。當(dāng)考慮到面向服務(wù)的環(huán)境中PHP腳本用來實現(xiàn)提供其他地方的一個“混搭”的服務(wù),這種假設(shè)是合理的。除了簡單的網(wǎng)站情況下,例如公告板中PHP腳本只是一個包裝到一個數(shù)據(jù)庫。在本文中所描述的場景中,動態(tài)內(nèi)容生成器提供動態(tài)內(nèi)容頁組成,除了客戶端實現(xiàn)。它通過使用標(biāo)準(zhǔn)協(xié)議諸如HTTP或應(yīng)用程序/中間件特定協(xié)議連接到后端服務(wù)器。JSP技術(shù)可以被認(rèn)為是對PHP在執(zhí)行這些前端的一種選擇。雖然它是Java Servlet

7、的框架的一部分,開發(fā)人員通常使用JSP來實現(xiàn)輕量級前端。PHP和JSP允許開發(fā)人員可以編寫HTML嵌入代碼。事實上,雖然PHP和Java之間有著固有的不同之處,但PHP的腳本和JSP文件在使用上的差異可能會非常相似。在這份文件中詳細(xì)介紹了實驗的目的是衡量結(jié)合諸如Apache和Lighttpd的流行Web服務(wù)器,使用PHP和JSP編寫的輕量級前端動態(tài)內(nèi)容生成器性能。此Web服務(wù)器架構(gòu)方案涉及用戶訪問使用純靜態(tài)頁面HTML編寫的Web服務(wù)器,以及JSP和PHP腳本混合腳本語言和HTML代碼。本文內(nèi)承擔(dān)的配置是一個典型的,其中Web服務(wù)器軟件,如Apache,后綴與純粹的HTML,JSP和PHP等之

8、間的區(qū)別分別是.html,.jsp和.php。HTML代碼是直接返回到最終用戶請求的網(wǎng)絡(luò)瀏覽器,在JSP和PHP頁面分別由Tomcat的腳本引擎和PHP運行時引擎提供純HTML轉(zhuǎn)發(fā)給最終在遠(yuǎn)程系統(tǒng)的用戶進(jìn)行解析。JSP和PHP之間的共同點是,這些執(zhí)行良好的實現(xiàn)有一個動態(tài)編譯和緩存的字節(jié)碼。例如,Java運行時使用Tomcat的腳本引擎,當(dāng)實時(JIT)編譯器功能來創(chuàng)建有效的本地緩存的運行時代碼時我們執(zhí)行越好。同樣,我們使用了Zend的PHP運行時當(dāng)可替代的PHP緩存(APC)啟用,則執(zhí)行明顯好,從共享內(nèi)存中APC存儲PHP字節(jié)碼,以便將來重用腳本源代碼。 表1 示例PHP和JSP腳本與生成的H

9、TML代碼PHP ScriptJSP ScriptR esulting HTML Code The date is The date is The date isTue, 1 Jan 0812:00:00 3語言運行時性能微標(biāo)桿為了了解PHP語言運行時水平在性能特點上的不同,我們比較了用微型基準(zhǔn)測試一下引擎:-PHP的4.4.7-PHP的5.2.3-Java 5與實時(JIT)編譯(IBM的J9虛擬機(jī)1.5.0 Build 2.3)-Java 5 不只是實時(JIT)編譯(同上)PHP語言框架允許開發(fā)人員擴(kuò)展這些用C語言編寫的功能,這些功能被稱為“擴(kuò)展”,稱為庫函數(shù)的語言,然后提供給PHP腳本

10、內(nèi)使用。PHP運行時提供了多種擴(kuò)展的字符串操作,文件處理,網(wǎng)絡(luò)等等。由于我們的首要目標(biāo)是了解PHP運行時本身的性能,我們實施的實驗沒有使用擴(kuò)展。我們制定了以下微基準(zhǔn):-以100個整數(shù)進(jìn)行快速排序的基準(zhǔn)-一個Levenshtein基準(zhǔn)檢測兩行56個字符的字符串的相似性-一個斐波納契計算基準(zhǔn),在一個任意兩個初始值斐波納契數(shù)列第15的值。這些PHP的基準(zhǔn)完全用PHP原始語言實現(xiàn)和避免了PHP擴(kuò)展的使用。Java的版本也側(cè)重于利用原始的語言而不是標(biāo)準(zhǔn)類的語言。我們比較了每個引擎執(zhí)行每個測試10000次的總運行時間。每個測試前我們也執(zhí)行作為熱身的額外10000次測量基準(zhǔn)。這可以防止在Java影響得分的測

11、試中即時編譯。我們在3.40GB的RAM內(nèi)存,4CPU的Intel奔騰與Linux2.6.17內(nèi)核上運行實驗。此測試演示測量之間的腳本語言和實現(xiàn)的巨大性能差異。圖1中的實驗結(jié)果表明,“JIT編譯的Java 5”性能最好,在所有測量案件中“沒有JIT編譯的Java 5”,“PHP的5.2.3”,“PHP的4.4.7”次之。Java 5基于有效地生成本地代碼使用,結(jié)合JIT演示了近三個數(shù)量級更好性能的訂單。顯而易見的是,PHP的5.2.3有兩倍至三倍的性能改進(jìn)超過實際測量計算的PHP的4.4.7。其次,以PHP與Java類的方法相比確定擴(kuò)展性能的影響,我們開發(fā)和測試三種額外的微基準(zhǔn):常規(guī)的表達(dá)式匹

12、配,MD5編碼和Levenshtein比較。對于常規(guī)表達(dá)式匹配,Perl兼容常規(guī)表達(dá)式擴(kuò)展(通過preg_match()函數(shù))使用PHP和在Java中使用java.util.regex包。對于MD5編碼,MD5的擴(kuò)展也在PHP中使用和在Java中使用java.security.MessageDigest。這個實驗沒有比較完全相同的邏輯,而是表明PHP擴(kuò)展的使用與Java即時編譯競爭,如圖2所示。盡管實驗結(jié)果顯示純腳本的三個數(shù)量級在Java和PHP上實現(xiàn)更少的性能差異訂單,但是PHP的擴(kuò)展使用(用C語言編寫)和編譯Java類庫的變化表現(xiàn)出很大的不同。在極端情況下,正常的表達(dá)式測試顯示Java和P

13、HP之間最高的性能差異大約為5分鐘,在另一方面,Java和PHP在MD5測試結(jié)果中幾乎相等。因此,一個例如PHP等腳本語言解釋的固有性能風(fēng)險是可以利用高效率的庫函數(shù)來克服的,如使用C語言編寫的PHP擴(kuò)展。4議論 其中一個審查性能基準(zhǔn)測試結(jié)果時,它出現(xiàn)在腦海的第一個問題是,“為什么JSP往往在高負(fù)荷下有更好的表現(xiàn),然后PHP?”一個主要的原因是Java準(zhǔn)時(JIT)編譯器。雖然JIT一直與PHP APC相比,APC是僅僅從而降低了對源代碼的重新演繹的需要,而JIT實現(xiàn)高度優(yōu)化的本地機(jī)器指令的執(zhí)行字節(jié)碼緩存。這反映在圖14中,其中的Java有JIT示出了在運行時引擎花費最少的時間。另一個因素是,J

14、SP通過線程模型來實現(xiàn)并行化,而在本試驗所采用的常用的Apache工人/ mod_php的方法,通過使用多個進(jìn)程來實現(xiàn)并行化。這樣高的CPU負(fù)載下,人們會期望與JSP實現(xiàn)使用的線程模型少調(diào)度和上下文切換的開銷。 另一個看似反常的一點是,使用PHP與Lighttpd的在支持方案優(yōu)于JSP在高負(fù)載下,這意味著PHP可以處理比JSP I / O更好。原來,人們所期望的節(jié)目的不同性能特性,例如這是寫在低C級PHP運行時,并且基于Java JSP環(huán)境的。在Web服務(wù)器體系結(jié)構(gòu)的差異也發(fā)揮的一個因素,在這里似乎最好Apache的多進(jìn)程“prefork的”做法,Lighttpd的使用異步事件處理的方法。使用

15、過程中的語言處理時相當(dāng)輕巧,如與mod_php的情況下出現(xiàn)的案例。同樣的,外部語言處理與Tomcat類似是避免重量級JVM復(fù)制每個進(jìn)程取得成功。通過FCGI外部語言處理的辦法也出現(xiàn)與Lighttpd的非常成功。內(nèi)部mod_php的方法的優(yōu)點在于從硬盤讀取數(shù)據(jù)時可立即到Apache,因為PHP引擎在同一個地址空間作為Apache守護(hù)進(jìn)程運行。但是,JVM使用用JSP和PHP通過FCGI訪問運行在一個單獨的進(jìn)程,從而招致域套接字通信開銷從工藝上下文切換和傳輸協(xié)調(diào)文件數(shù)據(jù)從一個進(jìn)程到另一個,以及潛在的低效率。5相關(guān)工作 Titchkosky和同事建立了服務(wù)于動態(tài)網(wǎng)頁內(nèi)容可以通過8倍的吞吐量減少與靜態(tài)

16、Web內(nèi)容相比,為廣大團(tuán)隊的鼓勵,以確定方法,減少使用腳本語言的動態(tài)Web內(nèi)容的負(fù)面的性能影響。拉瑪納和普拉巴卡爾分析PHP和匯編語言如C之間的性能差異,指出PHP的相對性能缺點,這與我們對純腳本執(zhí)行的基準(zhǔn)測試對比對應(yīng)。用C語言實現(xiàn)的標(biāo)準(zhǔn)類庫或PHP擴(kuò)展腳本。我們的標(biāo)桿的好處是,我們發(fā)現(xiàn)使用C語言PHP擴(kuò)展的計算密集型功能,使PHP腳本使用Java進(jìn)行同等。Cecchet和他的同事分析的基礎(chǔ)上的技術(shù),如Apache,PHP,Tomcat的,MySQL的,和Jonas3,17,這有助于指導(dǎo)我們的方法不同的中間件架構(gòu)。Warner和Worley描述諸如PHP,而不是僅僅針對JSP現(xiàn)實世界與SPEC

17、web200518利用基準(zhǔn)技術(shù)的重要性。因為我們沒有一個行業(yè)標(biāo)準(zhǔn)Web服務(wù)器基準(zhǔn)測試,它提供的性能PHP和JSP的Web服務(wù)器動態(tài)腳本語言進(jìn)行了詳細(xì)的比較可以看出,我們的數(shù)據(jù)已經(jīng)到這種推理貢獻(xiàn),因為我們是動機(jī)寫文章。外文原文 Performance Comparison of PHP and JSP as Server-Side Scripting LanguagesMaterialSource: Notesin Computer Science Author: Scott Trent; Michiaki Tatsubori; Toyotaro Suzumura; Akihiko Tozawa

18、 and Tamiya OnoderaAbstract. The dynamic scripting language PHP has become enormously popular for implementing lightweight web applications, and is widely used as a server-side scripting language for web servers. To contrast the performance of PHP and JSP for this purpose, we used the SPECweb2005 be

19、nchmark, which provides three application scenarios implemented in both PHP and JSP. This paper describes and contrasts the results of SPECweb2005 performance benchmark testing performed on different configurations of PHP and JSP using the popular web servers Apache and Lighttpd. Despite the executi

20、on overhead of interpretation in PHP engines observed in micro benchmarks, the experimental result of SPECweb2005 benchmark yields valuable performance data for web server implementers. The efficiency of scripting language runtimes still matters for the end-to-end performance. However, once carefull

21、y architected and tuned, the language runtime is less of a bottleneck than the web server performance itself.Keywords: PHP, JSP, SPECweb, Benchmarking, Web Server1 IntroductionThe dynamic scripting language PHP(PHP Hypertext Preprocessor) has become enormously popular for implementing lightweight we

22、b applications,and is widely used to access databases and other middleware.Apache module popularity surveys performed by Security Space in October 2007 indicate that 37% of Apache servers have PHP support enabled ,making it the most popular Apache module by 10 percentage points.Businesses are quickl

23、y realizing the powerful combination of a service oriented architecture environment with dynamic scripting languages like PHP .However,we believe that there are still critical performance issues involving PHP which remain to be investigated.This paper focuses on the use of dynamic scripting language

24、s to implement web server front-end interfaces. This corresponds with the way that the industry standard web server performance benchmark SPECweb2005 utilizes PHP and JSP ( JavaServer Pages).In this case, scripts are used for the implementation of dynamic page generation, rather than the realization

25、 of complex business logic. This contrasts with the traditional uses of complex JSP-based business logic implementation.While there are numerous studies on dynamic web content, this paper complements these studies with detailed analysis focusing on PHP. For example, following the performance study o

26、n CGI (Common Gateway Interface) based web servers for dynamic content by Yeager & McGrath back in 1995, researchers and practitioners have been examining the performance of more recent dynamic Webcontent generation technologies. These works, however, handle application scenarios where servlet front

27、-ends implement relatively complex business logic. Although Warner and Worley discuss the importance of also using PHP with SPECweb2005, to the best of the authors knowledge, this paper is the first to publish a detailed analysis of SPECweb2005 experimental results using both PHP and JSP. The detail

28、ed analysis of PHP and JSP performance based on SPECweb2005 offered by this paper enables designers and implementers of web servers to understand the relative performance and through put of different versions and configurations of PHP and JSP.2 Multi-tier Web Server Architecture: Lightweight Front-E

29、nd Using PHP/JSP Developers typically use PHP to implement a front-end interface to dynamic Web content generators, which are combined with web server software and back-end servers to provide dynamic content. The web server directly handles requests for static content and forwards requests for dynam

30、ic content to the dynamic content generator. The dynamic content generator, supported by back-end servers, executes code which realizes the business logic of a web site and stores dynamic state. Back-end servers may be implemented as a straight-forward database, or may be more complex servers handli

31、ng the business logic of the web site. The front-end implementation may vary from heavy-weight business logic handlers to lightweight clients composing content received from back-end servers. This paper focuses on multi-tier web site development scenarios utilizing such lightweight front-ends, suppo

32、rted by one or more layers of heavy-weight back-ends. This assumption is reasonable when considering Service-Oriented environments where PHP scripts are used to implement a mash-up of services provided elsewhere, in addition to the case of simple web sites such as bulletin boards where PHP scripts a

33、re just a wrapper to a database. Within the scenarios described in this paper, the dynamic content generator provides client implementation in addition to page composition. It connects to the back-end server through a network using either standard protocols such as HTTP or application/middleware-spe

34、cific protocols.JSP technology can be considered an alternative to PHP in implementing such front-ends. While it is part of the Java Servlet framework, developers typically use JSP to implement lightweight front-ends. Both PHP and JSP allow developers to write HTML embedded code. In fact, although t

35、here are language inherent differences between PHP and Java, the use of PHP scripts and JSP files can be very similar. The objective of the experiments detailed in this paper is to measure the performance of lightweight front-end dynamic content generation written in PHP and JSP with popular web ser

36、vers such as Apache and Lighttpd. This web server architecture scenario involves users who access a web server with pages written in plain static HTML, as well as JSP and PHP scripts which mix scripting language with HTML code. The configuration assumed within the paper is a typical one, where web s

37、erver software, such as Apache, distinguishes between pure HTML, JSP, and PHP respectively with suffixes such as .html, .jsp, and .php. HTML code is directly returned to the requesting end-users web browser, where JSP and PHP pages are respectively parsed by the Tomcat script engine and the PHP runt

38、ime engine which both provide pure HTML which is forwarded to the end-user on a remote system. A common point between JSP and PHP is that implementations which perform well have a dynamically compiled and cached byte code. For example, the Java runtime used by the Tomcat script engine which we used

39、performs much better when the Just-in-Time (JIT) compiler is enabled to create efficient cached native runtime code. Similarly, the Zend PHP runtime we used also performs significantly better when the Alternative PHP Cache (APC) is enabled, in which APC stores PHP byte codes compiled from the script

40、 source code in shared memory for future reuse. Table 1. Sample PHP and JSP scripts with resulting HTML codePHP ScriptJSP ScriptR esulting HTML Code The date is The date is The date isTue, 1 Jan 0812:00:00 3 Language Runtime Performance Micro BenchmarkingTo understand the difference in performance c

41、haracteristics between PHP and Java at the language runtime level,we compared the following engines using a series of micro benchmark tests:- PHP 4.4.7 - PHP 5.2.3 - Java 5 with Just-In-Time (JIT) compilation (IBM J9 VM 1.5.0 Build 2.3) - Java 5 without Just-In-Time (JIT) compilation (same as above)

42、The PHP language framework allows developers to extend the language with library functions written in C. These functions, which are known as extensions, are then available to be used within PHP scripts. The PHP runtime provides a variety of extensions for string manipulation, file handling, networki

43、ng, and so forth. Since our first goal was to understand the performance of the PHP runtime itself, we conducted our experiments without the use of extensions. We developed the following micro benchmarks: - A quick sort benchmark which sorts 100 integers, - A Levenshtein benchmark which measures the

44、 similarity between two strings of 56 characters, -A Fibonacci benchmark which calculates the 15th value in a Fibonacci series with two arbitrary starting values.These PHP benchmarks were implemented entirely with PHP language primitives and avoided the use of PHP extensions. The Java versions also

45、focused on using language primitives rather than standard classes. We compared the total run time of executing each test 10,000 times with each engine. We also executed each benchmark an additional 10,000 times as a warm-up, before the measured test. This prevents Java just-in-time compilation overh

46、ead from impacting the score in the Java tests. We ran the experiment on an Intel Pentium 4 CPU at 3.40 GHz with 3GB RAM Memory, with the Linux 2.6.17 kernel. This test demonstrates large performance differences between each of themeasured scripting languages and implementations. The experimental re

47、sults in Figure 1 indicate that “Java 5 with JIT compilation” performs the best, followed “Java 5 without JIT compilation”, “PHP 5.2.3”, and “PHP 4.4.7” in all measured cases. Java 5 with JIT demonstrated nearly three orders of magnitude better performance due to the use of efficiently generated nat

48、ive code. It is also obvious that PHP 5.2.3 has a two to three times performance improvement over PHP 4.4.7 with the measured computations. Secondly to determine the performance effect of PHP extensions compared with Java class methods, we developed and tested three additional micro benchmarks: regu

49、lar expression matching, MD5 encoding, and Levenshtein comparison. For regular expression matching, the Perl Compatible Regular Expression extension (through the preg_match() function) was used in PHP, and the java. util.regex package was used in Java. For MD5 encoding, the MD5 extension was used in

50、 PHP and java.security. MessageDigest was used in Java. This experiment does not compare exactly the same logic, but rather demonstrates that the use of PHP extensions is competitive with Java using just-in-time compilation, as seen in Figure 2.Although the pure script experiment showed three orders

51、 of magnitude difference between the performance of various implementations of Java and PHP, the use of PHP extensions (written in C) and compiled Java class libraries show much less variation. In the extreme, the regular expression test showed a maximum performance difference of about five times be

52、tween Java and PHP, on the other end, the MD5 test results were nearly equivalent between Java and PHP. Thus a inherent performance risk of interpreted scripted languages such as PHP can be overcome with the use of efficient library functions such as PHP extensions written in C.4 DiscussionOne of th

53、e first questions which comes to mind when reviewing the performance benchmark results is, “Why does JSP tend to perform better then PHP under high loads?” One major reason is the Java Just in Time (JIT) Compiler. Although JIT has been compared with PHP APC, APC is merely a bytecode cache which redu

54、ces the need for re-interpretation of source code, whereas JIT enables the execution of highly optimized local machine instructions. This is reflected in Figure 14, where Java with JIT shows the least time spent in the runtime engine. Another factor is that JSP realizes parallelization through the t

55、hreading model, whereas the commonly used Apache worker/mod_php approach adopted in this testing realizes parallelization through the use of multiple processes. Thus under high CPU loads, one would expect less scheduling and context switch overhead with the threading model used with the JSP implemen

56、tation. Another seemingly anomalous point is that PHP used with Lighttpd outperformed JSP under high loads in the Support scenario, implying that PHP can handle I/O better than JSP. Initially, one would expect different performance characteristics of a program such as the PHP runtime which is writte

57、n in low level C, and that of the Java based JSP environment. The difference in web server architectures also plays a factor, where the asynchronous event-handling approach used in Lighttpd appears preferable to Apaches multi-process “prefork” approach. The use of in-process language processing appears successful when reasonably lightweight, as is the case with mod_php. Likewise, external language processing as with Tomcat seems to be successful by avoiding replication of a heavy-weight JVM for each process. The external language process

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論