




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、毕 业 设 计(论 文) 英 文 翻 译课题名称 系 部专 业班 级学 号姓 名指导教师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作为服务器脚本语言的性能比较资料来源: 计算机科学讲义 作者:Scott Trent;Michiaki Tatsubori;Toyotar
33、o Suzumura;Akihiko Tozawa 和Tamiya Onodera1简介动态脚本语言PHP(PHP超文本预处理器)已经成为非常流行的轻量级Web执行应用程序,并广泛用于访问数据库和其他中间件。2007年10月流行的Apache模块安全空间进行的调查表明,37%的Apache服务器支持PHP功能,以10个百分点使它成为最流行的Apache模块。企业正迅速实现与动态脚本语言,如PHP的面向服务的体系结构环境的强大组合。然而,我们相信仍然有重要的性能问题涉及到PHP,它仍有待于被调查。本文重点介绍了动态脚本语言的使用来实现Web服务器的前端接口。与此对应的方式,该行业标准的Web服务
34、器性能的基准SPECweb2005利用PHP和JSP(JavaServer页面)。在这种情况下,脚本是用于执行动态页面生成,而不是复杂的业务逻辑的实现。与此相反的传统用途是基于JSP的复杂的业务逻辑实现。虽然有许多动态网页内容的研究,本文补充了这些研究的详细分析,重点在于PHP中。例如,下面就CGI(通用网关接口)基于Web服务器的动态内容由耶格尔麦格拉思可追溯到1995年的性能研究,研究人员和从业者一直在研究最近的动态的WebContent技术性能。这些作品,然而,处理应用程序方案在servlet前端实现相对复杂的业务逻辑。虽然华纳和沃利也使用PHP与SPECweb2005,以作者所知的重要
35、性,本文是首次发布了使用PHP和JSP的SPECweb2005实验结果的详细分析。PHP和JSP的性能的详细分析是基于本文件所提供的SPECweb2005,使设计者和实施者了解Web服务器的相对性能,并通过把不同版本的PHP和JSP进行配置。2 多层Web服务器架构:使用PHP/JSP的轻量级前端开发人员通常使用PHP来实现一个生成动态Web内容的前端界面,这与Web服务器软件和后端服务器相结合,提供动态内容。该网站的服务器直接处理静态内容并转发请求动态内容生成动态内容。后端服务器支持动态内容生成,执行代码来实现一个网站和商店的动态状态的业务逻辑。后端服务器可以作为一个直接的数据库来实现,或者
36、可能更复杂的服务器处理该网站的业务逻辑。前端的执行可能有所不同于重量级的业务逻辑程序来处理从后端服务器接收轻量级客户端的内容。本文重点介绍多层Web站点开发利用这种由一个或多个重量级后端层支持轻量级的前端。当考虑到面向服务的环境中PHP脚本用来实现提供其他地方的一个“混搭”的服务,这种假设是合理的。除了简单的网站情况下,例如公告板中PHP脚本只是一个包装到一个数据库。在本文中所描述的场景中,动态内容生成器提供动态内容页组成,除了客户端实现。它通过使用标准协议诸如HTTP或应用程序/中间件特定协议连接到后端服务器。JSP技术可以被认为是对PHP在执行这些前端的一种选择。虽然它是Java Serv
37、let的框架的一部分,开发人员通常使用JSP来实现轻量级前端。PHP和JSP允许开发人员可以编写HTML嵌入代码。事实上,虽然PHP和Java之间有着固有的不同之处,但PHP的脚本和JSP文件在使用上的差异可能会非常相似。在这份文件中详细介绍了实验的目的是衡量结合诸如Apache和Lighttpd的流行Web服务器,使用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)启用,则执行明显
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 返租合同的协议
- 合伙协议合同范本4人
- 古代书画买卖合同协议
- 企业与食堂水电协议合同
- 合同协议六人怎样称呼
- 购买镜子合同协议书范本
- 蛋糕学徒合同协议
- 暂停租赁合同协议
- 设备场地租赁协议合同书
- 员工合同协议生效
- 《国家学生体质健康标准》登记卡
- 住院患者VTE相关评估量表课件
- 高中物理选修二第一章《安培力与洛伦兹力》测试题(含答案解析)
- 个体餐饮员工简易合同范本
- 2024年全国《劳动教育》基础知识考试题库与答案
- 非煤矿山安全教育培训试卷(答案)
- 江苏省徐州市睢宁县2023-2024学年七年级下学期期中考试数学试卷(含答案)
- 2024年北京市离婚协议书范文范本电子版
- 广告设计制作服务方案
- 中职护理专业护理服务质量评价体系研究
- 第八版口腔肿瘤TNM分期更新解读
评论
0/150
提交评论