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

下载本文档

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

文档简介

1、毕业设计外文资料翻译学 院: 专业班级: 学生姓名: 学 号: 指导教师: 外文出处:书名:Springer Berlin Heidelberg 页码:164-182 作者:S Trent,M Tatsubori,T Suzumura 附 件:1.外文资料翻译译文; 2.外文原文 指导教师评语:该英文资料选择合理,与毕业设计报告相关度比较高。专业术语、词汇翻译的准确度达到要求,体现了较高的专业英语应用水平。外文翻译与研究课题关系密切,翻译工作能够严格按照规定,达到考核、提高学生英语应用水平的目的,完成要求。 签名: 2015年 10月14日1外文资料翻译译文PHP和JSP作为服务器脚本语言的性

2、能比较摘要 动态脚本语言PHP已经成为实现轻量级的Web应用程序非常受欢迎,被广泛用作服务器端脚本语言的Web服务器。对比PHP和JSP的性能,为此,我们使用SPECweb2005基准,它提供了PHP和JSP实施了三个应用场景。本文介绍和对比上采用了时下流行的Web服务器Apache和PHP的Lighttpd和JSP的不同配置进行SPECweb2005性能基准测试的结果。尽管在微基准测试发现PHP引擎解释执行开销,SPECweb2005基准的实验结果得到了Web服务器的实施者有价值的性能数据。脚本语言运行时的效率仍然重要的终端到终端的性能。然而,一次精心架构和调整,语言运行时少的瓶颈不是Web

3、服务器的性能本身。关键词:PHP,JSP,SPECweb,标杆,Web服务器。1简介动态脚本语言PHP(PHP超文本预处理器)已经成为非常流行的轻量级Web执行应用程序,并广泛用于访问数据库和其他中间件。2007年10月流行的Apache模块安全空间进行的调查表明,37%的Apache服务器支持PHP功能,以10个百分点使它成为最流行的Apache模块。企业正迅速实现与动态脚本语言,如PHP的面向服务的体系结构环境的强大组合。然而,我们相信仍然有重要的性能问题涉及到PHP,它仍有待于被调查。本文重点介绍了动态脚本语言的使用来实现Web服务器的前端接口。与此对应的方式,该行业标准的Web服务器性

4、能的基准SPECweb2005利用PHP和JSP(JavaServer页面)。在这种情况下,脚本是用于执行动态页面生成,而不是复杂的业务逻辑的实现。与此相反的传统用途是基于JSP的复杂的业务逻辑实现。虽然有许多动态网页内容的研究,本文补充了这些研究的详细分析,重点在于PHP中。例如,下面就CGI(通用网关接口)基于Web服务器的动态内容由耶格尔麦格拉思可追溯到1995年的性能研究,研究人员和从业者一直在研究最近的动态的WebContent技术性能。这些作品,然而,处理应用程序方案在servlet前端实现相对复杂的业务逻辑。虽然华纳和沃利也使用PHP与SPECweb2005,以作者所知的重要性,

5、本文是首次发布了使用PHP和JSP的SPECweb2005实验结果的详细分析。PHP和JSP的性能的详细分析是基于本文件所提供的SPECweb2005,使设计者和实施者了解Web服务器的相对性能,并通过把不同版本的PHP和JSP进行配置。2多层Web服务器架构:使用PHP/JSP的轻量级前端开发人员通常使用PHP来实现一个生成动态Web内容的前端界面,这与Web服务器软件和后端服务器相结合,提供动态内容。该网站的服务器直接处理静态内容并转发请求动态内容生成动态内容。后端服务器支持动态内容生成,执行代码来实现一个网站和商店的动态状态的业务逻辑。后端服务器可以作为一个直接的数据库来实现,或者可能更

6、复杂的服务器处理该网站的业务逻辑。前端的执行可能有所不同于重量级的业务逻辑程序来处理从后端服务器接收轻量级客户端的内容。本文重点介绍多层Web站点开发利用这种由一个或多个重量级后端层支持轻量级的前端。当考虑到面向服务的环境中PHP脚本用来实现提供其他地方的一个“混搭”的服务,这种假设是合理的。除了简单的网站情况下,例如公告板中PHP脚本只是一个包装到一个数据库。在本文中所描述的场景中,动态内容生成器提供动态内容页组成,除了客户端实现。它通过使用标准协议诸如HTTP或应用程序/中间件特定协议连接到后端服务器。JSP技术可以被认为是对PHP在执行这些前端的一种选择。虽然它是Java Servlet

7、的框架的一部分,开发人员通常使用JSP来实现轻量级前端。PHP和JSP允许开发人员可以编写HTML嵌入代码。事实上,虽然PHP和Java之间有着固有的不同之处,但PHP的脚本和JSP文件在使用上的差异可能会非常相似。在这份文件中详细介绍了实验的目的是衡量结合诸如Apache和Lighttpd的流行Web服务器,使用PHP和JSP编写的轻量级前端动态内容生成器性能。此Web服务器架构方案涉及用户访问使用纯静态页面HTML编写的Web服务器,以及JSP和PHP脚本混合脚本语言和HTML代码。本文内承担的配置是一个典型的,其中Web服务器软件,如Apache,后缀与纯粹的HTML,JSP和PHP等之

8、间的区别分别是.html,.jsp和.php。HTML代码是直接返回到最终用户请求的网络浏览器,在JSP和PHP页面分别由Tomcat的脚本引擎和PHP运行时引擎提供纯HTML转发给最终在远程系统的用户进行解析。JSP和PHP之间的共同点是,这些执行良好的实现有一个动态编译和缓存的字节码。例如,Java运行时使用Tomcat的脚本引擎,当实时(JIT)编译器功能来创建有效的本地缓存的运行时代码时我们执行越好。同样,我们使用了Zend的PHP运行时当可替代的PHP缓存(APC)启用,则执行明显好,从共享内存中APC存储PHP字节码,以便将来重用脚本源代码。 表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语言运行时性能微标杆为了了解PHP语言运行时水平在性能特点上的不同,我们比较了用微型基准测试一下引擎:-PHP的4.4.7-PHP的5.2.3-Java 5与实时(JIT)编译(IBM的J9虚拟机1.5.0 Build 2.3)-Java 5 不只是实时(JIT)编译(同上)PHP语言框架允许开发人员扩展这些用C语言编写的功能,这些功能被称为“扩展”,称为库函数的语言,然后提供给PHP脚本

10、内使用。PHP运行时提供了多种扩展的字符串操作,文件处理,网络等等。由于我们的首要目标是了解PHP运行时本身的性能,我们实施的实验没有使用扩展。我们制定了以下微基准:-以100个整数进行快速排序的基准-一个Levenshtein基准检测两行56个字符的字符串的相似性-一个斐波纳契计算基准,在一个任意两个初始值斐波纳契数列第15的值。这些PHP的基准完全用PHP原始语言实现和避免了PHP扩展的使用。Java的版本也侧重于利用原始的语言而不是标准类的语言。我们比较了每个引擎执行每个测试10000次的总运行时间。每个测试前我们也执行作为热身的额外10000次测量基准。这可以防止在Java影响得分的测

11、试中即时编译。我们在3.40GB的RAM内存,4CPU的Intel奔腾与Linux2.6.17内核上运行实验。此测试演示测量之间的脚本语言和实现的巨大性能差异。图1中的实验结果表明,“JIT编译的Java 5”性能最好,在所有测量案件中“没有JIT编译的Java 5”,“PHP的5.2.3”,“PHP的4.4.7”次之。Java 5基于有效地生成本地代码使用,结合JIT演示了近三个数量级更好性能的订单。显而易见的是,PHP的5.2.3有两倍至三倍的性能改进超过实际测量计算的PHP的4.4.7。其次,以PHP与Java类的方法相比确定扩展性能的影响,我们开发和测试三种额外的微基准:常规的表达式匹

12、配,MD5编码和Levenshtein比较。对于常规表达式匹配,Perl兼容常规表达式扩展(通过preg_match()函数)使用PHP和在Java中使用java.util.regex包。对于MD5编码,MD5的扩展也在PHP中使用和在Java中使用java.security.MessageDigest。这个实验没有比较完全相同的逻辑,而是表明PHP扩展的使用与Java即时编译竞争,如图2所示。尽管实验结果显示纯脚本的三个数量级在Java和PHP上实现更少的性能差异订单,但是PHP的扩展使用(用C语言编写)和编译Java类库的变化表现出很大的不同。在极端情况下,正常的表达式测试显示Java和P

13、HP之间最高的性能差异大约为5分钟,在另一方面,Java和PHP在MD5测试结果中几乎相等。因此,一个例如PHP等脚本语言解释的固有性能风险是可以利用高效率的库函数来克服的,如使用C语言编写的PHP扩展。4议论 其中一个审查性能基准测试结果时,它出现在脑海的第一个问题是,“为什么JSP往往在高负荷下有更好的表现,然后PHP?”一个主要的原因是Java准时(JIT)编译器。虽然JIT一直与PHP APC相比,APC是仅仅从而降低了对源代码的重新演绎的需要,而JIT实现高度优化的本地机器指令的执行字节码缓存。这反映在图14中,其中的Java有JIT示出了在运行时引擎花费最少的时间。另一个因素是,J

14、SP通过线程模型来实现并行化,而在本试验所采用的常用的Apache工人/ mod_php的方法,通过使用多个进程来实现并行化。这样高的CPU负载下,人们会期望与JSP实现使用的线程模型少调度和上下文切换的开销。 另一个看似反常的一点是,使用PHP与Lighttpd的在支持方案优于JSP在高负载下,这意味着PHP可以处理比JSP I / O更好。原来,人们所期望的节目的不同性能特性,例如这是写在低C级PHP运行时,并且基于Java JSP环境的。在Web服务器体系结构的差异也发挥的一个因素,在这里似乎最好Apache的多进程“prefork的”做法,Lighttpd的使用异步事件处理的方法。使用

15、过程中的语言处理时相当轻巧,如与mod_php的情况下出现的案例。同样的,外部语言处理与Tomcat类似是避免重量级JVM复制每个进程取得成功。通过FCGI外部语言处理的办法也出现与Lighttpd的非常成功。内部mod_php的方法的优点在于从硬盘读取数据时可立即到Apache,因为PHP引擎在同一个地址空间作为Apache守护进程运行。但是,JVM使用用JSP和PHP通过FCGI访问运行在一个单独的进程,从而招致域套接字通信开销从工艺上下文切换和传输协调文件数据从一个进程到另一个,以及潜在的低效率。5相关工作 Titchkosky和同事建立了服务于动态网页内容可以通过8倍的吞吐量减少与静态

16、Web内容相比,为广大团队的鼓励,以确定方法,减少使用脚本语言的动态Web内容的负面的性能影响。拉玛纳和普拉巴卡尔分析PHP和汇编语言如C之间的性能差异,指出PHP的相对性能缺点,这与我们对纯脚本执行的基准测试对比对应。用C语言实现的标准类库或PHP扩展脚本。我们的标杆的好处是,我们发现使用C语言PHP扩展的计算密集型功能,使PHP脚本使用Java进行同等。Cecchet和他的同事分析的基础上的技术,如Apache,PHP,Tomcat的,MySQL的,和Jonas3,17,这有助于指导我们的方法不同的中间件架构。Warner和Worley描述诸如PHP,而不是仅仅针对JSP现实世界与SPEC

17、web200518利用基准技术的重要性。因为我们没有一个行业标准Web服务器基准测试,它提供的性能PHP和JSP的Web服务器动态脚本语言进行了详细的比较可以看出,我们的数据已经到这种推理贡献,因为我们是动机写文章。外文原文 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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论