PHP和JSP作为服务器脚本语言的性能比较-外文翻译_第1页
PHP和JSP作为服务器脚本语言的性能比较-外文翻译_第2页
PHP和JSP作为服务器脚本语言的性能比较-外文翻译_第3页
PHP和JSP作为服务器脚本语言的性能比较-外文翻译_第4页
PHP和JSP作为服务器脚本语言的性能比较-外文翻译_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、毕业设计(论文)英文翻译课题名称系 部 专 业 班 级 学 号 姓 名 指导教师2017年4月14 日Performance Comparison of PHP and JSP as Server-SideScripting LanguagesMaterialSource: Notesin Computer ScienceAuthor: Scott Trent; Michiaki Tatsubori; Toyotaro Suzumura; Akihiko Tozawa and Tamiya Onodera1 IntroductionThe dynamic scripting language

2、PHP(PHP Hypertext Preprocessor) has become enormously popular for implementing lightweight web applications,and is widely used to access databasesand other middleware.Apache module popularity surveys performed by Security Space in October 2007 indicate that 37% of Apache servers have PHP support ena

3、bled ,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 involving PHP

4、 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 this case, scr

5、ipts 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 complements these st

6、udies 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 Webcontent gen

7、eration 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 author ksnowledge, this paper is the first to publish

8、 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 different versions

9、and configurations of PHP and JSP.2 Multi-tier Web Server Architecture: Lightweight Front-End Using PHP/JSPDevelopers typically use PHP to impleme nt a fron t-e nd in terface to dyn amic Web content gen erators,which are comb ined with web server software and back-e nd servers to provide dynamic con

10、tent. The web server directly handles requests for static content and forwards requests for dynamic content to the dynamic content generator. The dynamic content gen erator, supported by back-e nd servers, executes code which realizes the bus in ess logic of a web site and stores dynamic state. Back

11、-end servers may be implemented as a straight-forward database, or may be more complex servers han dli ng the bus in ess logic of the web site. The fron t-e nd impleme ntati on may vary from heavy-weight bus in ess logic han dlers to lightweight clie nts compos ing content received from back-e nd se

12、rvers.This 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 assumpti on is reas on able whe n con sideri ng Service-Orie nted en vir onments where PHP scripts are used to implement a mash

13、-up of services provided elsewhere, in addition to the case of simple web sites such as bullet in boards where PHP scripts are just a wrapper to a database. Within the scenarios described in this paper, the dynamic content generator provides clie nt impleme ntati on in additi on to page compositi on

14、 .It conn ects to the back-e nd server through a network using either standard protocols such as HTTP or applicati on/middleware-specific protocols.JSP tech no logy can be con sidered an alter native to PHP in impleme nting such front-ends. While it is part of the Java Servlet framework, developers

15、typically use JSP to implement lightweight front-ends. Both PHP and JSP allow developers to write HTML embedded code. In fact, although there are Ian guage in here nt differe nces betwee n PHP and Java, the use of PHP scripts and JSP files can be very similar.The objective of the experime nts detail

16、ed in this paper is to measure the performa nee of lightweight fron t-e nd dyn amic content gen erati on writte n in PHP and JSP with popular web servers such as Apache and Lighttpd. This web server architecture scenario invoIves users who access a web server with pages written in plain static HTML,

17、 as well as JSP and PHP scripts which mix scripting Ianguage with HTML code. The configuration assumedwithin the paper is a typical one, where web server software, such as Apache, disti nguishes betwee n pure HTML, JSP, and PHP respectively with suffixes such as .html, .jsp, and .php. HTML code is d

18、irectly returned to the requesting end-useweb browser, where JSP and PHP pages are respectively parsed by the Tomcat script engine and the PHP run time engine which both provide pure HTML which is forwarded to the en d-user on a remote system. A com mon point between JSP and PHP is that implementati

19、ons which perform well have a dynamically compiled and cached byte code. For example, the Java run time used by the Tomcat script engine which we used performs much better when the Just-in-Time (JIT) compiler is enabled to create efficie nt cached n ative run time code. Similarly, the Zend PHP run t

20、ime we used also performs sig ni fica ntly better whe n the Alter native PHP Cache (APC) is en abled, 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 un dersta nd the differe nee in performa

21、 nee characteristics betwee n PHP and Java at the Ian guage run time level, we compared the followi ng engines using a series of micro ben chmark tests:-PHP 447-PHP 5.2.3-Java 5 with Just In-Time (JIT) compilation (IBM J9 VM 1.5.0 Build 2.3 )-Java 5 without Jus- In- Time (JIT) compilation (same as a

22、bove)The PHP Ian guage framework allows developers to exte nd the Ian guage with library functions written in C. These functions, which are known as extensions, are then available to be used within PHP scripts. The PHP run time provides a variety of exte nsions for stri ng manipulation, file handlin

23、g, networking, and so forth. Since our first goal was to understand the performa nce of the PHP run time itself, we con ducted our experime nts without the use of exte nsions. We developed the followi ng micro ben chmarks:-A quick sort ben chmark which sorts 100 in tegers,-A Levenshtein benchmark wh

24、ich measures the similarity between two strings of 56 characters,-A Fib on acci ben chmark which calculates the 15th value in a Fib on acci series with two arbitrary starti ng values.These PHP ben chmarks were impleme nted en tirely with PHP Ian guage primitives and avoided the use of PHP extensions

25、. The Java versions also focused on using Ianguage 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 preve nts Java just

26、-i n-time compilatio n overhead from impact ing the score in the Java tests. We ran the experime nt on an In tel Pen tium 4 CPUat 3.40 GHz with 3GB RAM Memory, with the Linux 2.6.17 kernel.This test dem on strates large performa nee differe nces betwee n each of themeasuredscripting Ianguages and im

27、plementations. The experimental results in Figure 1 indicate thatJava 5 with JIT compilati onperformsoheweristJava 5 without JIT compilati onPHF5.2.3 ” and “ PHPL4.7 ” all measured cases.Java 5 with JIT dem on strated n early three orders of magn itude better performa nee due to the use of efficie n

28、tly gen erated n ative 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 exte nsions compared with Java class methods, we developed and tested three additi onal m

29、icro ben chmarks: regular expressi on matchi ng, MD5 en cod ing, and Leve nshte in 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, t

30、he MD5 extension was used in PHP and java.security. MessageDigest was used in Java. This experime nt does not compare exactly the same logic, but rather dem on strates that the use of PHP exte nsions is competitive with Java using just-i n-time compilati on, as see n in Figure 2.Although the pure sc

31、ript experiment showed three orders 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 expressi on test showed a maximum performa

32、nce differe nce of about five times betwee n Java and PHP, on the other end, the MD5 test results were n early equivale nt betwee n Java and PHP.Thus a in here nt performa nce risk of in terpreted scripted Ian guages such as PHP can be overcome with the use of efficient library functions such as PHP

33、 exte nsions writte n in C.PHP和JSP作为服务器脚本语言的性能比较资料来源:计算机科学讲义作者:Scott Trent; Michiaki Tatsubori ; Toyotaro Suzumura Akihiko Tozawa 和 Tamiya Ono dera1简介动态脚本语言PHP( PHP超文本预处理器)已经成为非常流行的轻量级 Web执行 应用程序,并广泛用于访问数据库和其他中间件。 2007年10月流行的Apache模块安 全空间进行的调查表明,37%的Apache服务器支持PHP功能,以10个百分点使它成 为最流行的Apache模块。企业正迅速实现与

34、动态脚本语言,如PHP的面向服务的体系 结构环境的强大组合。然而,我们相信仍然有重要的性能问题涉及到PHP,它仍有待于被调查。本文重点介绍了动态脚本语言的使用来实现Web服务器的前端接口。与此对应的方式,该行业标准的 Web服务器性能的基准 SPECweb2005利用PHP和JSP(JavaServer 页面)。在这种情况下,脚本是用于执行动态页面生成,而不是复杂的业务逻辑的实现。 与此相反的传统用途是基于JSP的复杂的业务逻辑实现。虽然有许多动态网页内容的研 究,本文补充了这些研究的详细分析,重点在于PHP中。例如,下面就CGI (通用网关接口)基于 Web服务器的动态内容由耶格尔麦格拉思可

35、追溯到1995年的性能研究,研究人员和从业者一直在研究最近的动态的WebCo nte nt技术性能。这些作品,然而,处理应用程序方案在servlet前端实现相对复杂的业务逻辑。虽然华纳和沃利也使用PHP与SPECweb2005以作者所知的重要性,本文是首次发 布了使用PHP和JSP的SPECweb2005实验结果的详细分析。PHP和JSP的性能的详细 分析是基于本文件所提供的SPECweb2005使设计者和实施者了解Web服务器的相对 性能,并通过把不同版本的 PHP和JSP进行配置。2多层Web服务器架构:使用 PHP/JSP的轻量级前端开发人员通常使用PHP来实现一个生成动态 Web内容的

36、前端界面,这与Web服务 器软件和后端服务器相结合,提供动态内容。该网站的服务器直接处理静态内容并转发 请求动态内容生成动态内容。后端服务器支持动态内容生成,执行代码来实现一个网站 和商店的动态状态的业务逻辑。后端服务器可以作为一个直接的数据库来实现,或者可能更复杂的服务器处理该网站的业务逻辑。 前端的执行可能有所不同于重量级的业务逻辑程序来处理从后端服务器接收轻量级客户端的内容本文重点介绍多层Web站点开发利用这种由一个或多个重量级后端层支持轻量级 的前端。当考虑到面向服务的环境中 PHP脚本用来实现提供其他地方的一个“混搭” 的服务,这种假设是合理的。除了简单的网站情况下,例如公告板中PH

37、P脚本只是一个包装到一个数据库。在本文中所描述的场景中,动态内容生成器提供动态内容页组成, 除了客户端实现。它通过使用标准协议诸如 HTTP或应用程序/中间件特定协议连接到 后端服务器。JSP技术可以被认为是对PHP在执行这些前端的一种选择。虽然它是 Java Servlet 的框架的一部分,开发人员通常使用 JSP来实现轻量级前端。PHP和JSP允许开发人 员可以编写HTML嵌入代码。事实上,虽然PHP和Java之间有着固有的不同之处,但 PHP的脚本和JSP文件在使用上的差异可能会非常相似。在这份文件中详细介绍了实验的目的是衡量结合诸如Apache和Lighttpd的流行Web服务器,使用

38、PHP和JSP编写的轻量级前端动态内容生成器性能。此 Web服务器 架构方案涉及用户访问使用纯静态页面HTML编写的Web服务器,以及JSP和PHP脚本混合脚本语言和HTML代码。本文内承担的配置是一个典型的,其中Web服务器软件,如Apache,后缀与纯粹的HTML, JSP和PHP等之间的区别分别是.html,.jsp 和.php。HTML代码是直接返回到最终用户请求的网络浏览器,在JSP和PHP页面分别由Tomcat的脚本引擎和PHP运行时引擎提供纯HTML转发给最终在远程系统的用 户进行解析。JSP和PHP之间的共同点是,这些执行良好的实现有一个动态编译和缓 存的字节码。例如,Java运行时使用Tomcat的脚本引擎,当实时(JIT)编译器功能来 创建有效的本地缓存的运行时代码时我们执行越好。同样,我们使用了 Zend的PHP运行时当可替代的PHP缓存(APC)启用,则执行明显好,从共享内存中 APC存储PHP 字节码

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论