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

下載本文檔

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

文檔簡介

1、畢 業(yè) 設(shè) 計(論 文) 英 文 翻 譯課題名稱 系 部專 業(yè)班 級學(xué) 號姓 名指導(dǎo)教師2017 年 4 月 14 日Performance Comparison of PHP and JSP as Server-Side Scripting LanguagesMaterialSource: Notesin Computer Science Author: Scott Trent; Michiaki Tatsubori; Toyotaro Suzumura; Akihiko Tozawa and Tamiya Onodera1 IntroductionThe dynamic scripting

2、 language PHP(PHP Hypertext Preprocessor) has become enormously popular for implementing lightweight web 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

3、support enabled ,making it the most popular Apache module by 10 percentage points.Businesses are quickly 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 in

4、volving PHP which remain to be investigated.This paper focuses on the use of dynamic scripting languages 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 thi

5、s case, scripts are used for the implementation of dynamic page generation, rather than the realization 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 complemen

6、ts these studies with detailed analysis focusing on PHP. For example, following the performance study on 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 Web

7、content generation technologies. These works, however, handle application scenarios where servlet front-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 firs

8、t to publish a detailed analysis of SPECweb2005 experimental results using both PHP and JSP. The detailed 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 differe

9、nt versions and configurations of PHP and JSP.2 Multi-tier Web Server Architecture: Lightweight Front-End 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 dynam

10、ic content. The web server directly handles requests for static content and forwards requests for dynamic 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. Ba

11、ck-end servers may be implemented as a straight-forward database, or may be more complex servers handling 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

12、paper focuses on multi-tier web site development scenarios utilizing such lightweight front-ends, supported 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 prov

13、ided elsewhere, in addition to the case of simple web sites such as bulletin boards where PHP scripts are 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-

14、end server through a network using either standard protocols such as HTTP or application/middleware-specific 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 lig

15、htweight front-ends. Both PHP and JSP allow developers to write HTML embedded code. In fact, although there 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 perf

16、ormance of lightweight front-end dynamic content generation written in PHP and JSP with popular web servers 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 scri

17、pting language with HTML code. The configuration assumed within the paper is a typical one, where web server 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 we

18、b browser, where JSP and PHP pages are respectively parsed by the Tomcat script engine and the PHP runtime 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 compi

19、led and cached byte code. For example, the Java runtime used by the Tomcat script engine which we used 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

20、the Alternative PHP Cache (APC) is enabled, in which APC stores PHP byte codes compiled from the script source code in shared memory for future reuse.3 Language Runtime Performance Micro BenchmarkingTo understand the difference in performance characteristics between PHP and Java at the language runt

21、ime 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)The PHP language framework allows developers to extend t

22、he 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, networking, and so forth. Since our first goal was to understand

23、 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 similarity between two strings of 56 characters, -A Fib

24、onacci 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 focused on using language primitives rather than standar

25、d 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 overhead from impacting the score in the Java tests. We ran t

26、he 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 results in Figure 1 indicate that “Java 5 with JIT compila

27、tion” 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 native code. It is also obvious that PHP 5.2.3 has a two to

28、 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: regular expression matching, MD5 encoding, and Levenshtein c

29、omparison. 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 PHP and java.security. MessageDigest was used in Java.

30、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 of magnitude difference between the performance of vari

31、ous 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 between Java and PHP, on the other end, the MD5 test resul

32、ts 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. PHP和JSP作為服務(wù)器腳本語言的性能比較資料來源: 計算機科學(xué)講義 作者:Scott Trent;Michiaki Tatsubori;Toyotar

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

34、器性能的基準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)容的研究,本文補充了這些研究的詳細分析,重點在于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,以作者所知的重要

35、性,本文是首次發(fā)布了使用PHP和JSP的SPECweb2005實驗結(jié)果的詳細分析。PHP和JSP的性能的詳細分析是基于本文件所提供的SPECweb2005,使設(shè)計者和實施者了解Web服務(wù)器的相對性能,并通過把不同版本的PHP和JSP進行配置。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),或者

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

37、let的框架的一部分,開發(fā)人員通常使用JSP來實現(xiàn)輕量級前端。PHP和JSP允許開發(fā)人員可以編寫HTML嵌入代碼。事實上,雖然PHP和Java之間有著固有的不同之處,但PHP的腳本和JSP文件在使用上的差異可能會非常相似。在這份文件中詳細介紹了實驗的目的是衡量結(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)承擔的配置是一個典型的,其中Web服務(wù)器軟件,如Apache,后綴與純粹的HTML,JSP和PHP等之間的區(qū)別分別是.html,.jsp和.php。HTML代碼是直接返回到最終用戶請求的網(wǎng)絡(luò)瀏覽器,在JSP和PHP頁面分別由Tomcat的腳本引擎和PHP運行時引擎提供純HTML轉(zhuǎn)發(fā)給最終在遠程系統(tǒng)的用戶進行解析。JSP和PHP之間的共同點是,這些執(zhí)行良好的實現(xiàn)有一個動態(tài)編譯和緩存的字節(jié)碼。例如,Java運行時使用Tomcat的腳本引擎,當實時(JIT)編譯器功能來創(chuàng)建有效的本地緩存的運行時代碼時我們執(zhí)行越好。同樣,我們使用了Zend的PHP運行時當可替代的PHP緩存(APC)啟用,則執(zhí)行明顯

溫馨提示

  • 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論