外文翻译--数据在ASP.NET中绑定的表现实证研究.docx_第1页
外文翻译--数据在ASP.NET中绑定的表现实证研究.docx_第2页
外文翻译--数据在ASP.NET中绑定的表现实证研究.docx_第3页
外文翻译--数据在ASP.NET中绑定的表现实证研究.docx_第4页
外文翻译--数据在ASP.NET中绑定的表现实证研究.docx_第5页
已阅读5页,还剩27页未读 继续免费阅读

下载本文档

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

文档简介

附件1:外文资料翻译译文数据在ASP.NET中绑定的表现实证研究 Web应用程序 托尼斯托扬诺夫斯基,马尔科,和伊万沃立诺夫 信息学,欧洲大学,斯科普里,马其顿共和国摘要开发Web应用程序时,大多数开发人员使用ASP.NET服务器控件的默认属性。 ASP.NET Web应用程序通常使用服务器控件来提供动态网页和数据绑定服务器控件来显示和维护数据库中的数据。虽然默认的属性允许用于快速创建可行的应用程序,创建一个高性能,多用户,以及可扩展的Web应用程序,需要仔细配置的服务器控件及其使用增强定制代码。在提供普遍需要的功能在数据驱动的ASP.NET Web应用程序,如分页,排序和筛选,我们的实证研究评估了各种技术方法的影响:在Web服务器控件自动数据绑定,数据分页和Web服务器上的排序,分页和排序的数据库服务器上,索引和非索引数据库中的列;聚集与非聚集索引。该研究观察到的各种技术approaches.Index术语之间显著的性能差异 - Web应用程序,可扩展性,数据库访问1.介绍在过去的几年中,我们正在观察的Web应用程序。这是一个后果因素:零客户端安装,服务器,功能强大的开发工具,不断增长的用户群等。此外,竞争和快速变化和不断增长的用户为Web应用快速发展的需求。微软的Visual Studio ( MVS )是当今的主流网络应用程序开发环境。 MVS提供了许多机制,以支持ASP.NET应用程序的快速开发。大多数开发人员倾向于默认的ASP.NET机制:页面缓存,在HTTP (会话,饼干,隐藏的HTML控件等) ,数据管理,以及ASP.NET服务器控件它可以说是最显著推动者的引进已发展快速发展。虽然这些机制和ASP.NET服务器控件可以显著降低应用程序的“上市时间” ,同时他们可以减少Web应用程序的性能和可伸缩性。的是影响Web应用程序的响应时间的因素分析是一个活跃的研究领域 1 。在本文中,我们证明,以提高Web应用的性能和可扩展性添加自定义程序逻辑到ASP.NET服务器控件的重要性。这里我们把重点放在数据绑定机制,也就是所使用的机制,以保持和显示数据。其他机制,如数据更新, PAG缓存,数据缓存,状态管理等,都留给未来的工作。在这里,我们讨论了以下研究问题:l 这是寻呼机制的影响响应时间?l 什么是指数对响应时间的影响排序和分页的结果什么时候l 这是响应时间的依赖数据库记录数?l 什么情况下,当它是更好地使用ASP.NET服务器控件?什么时候最好使用自定义存储过程获取,分类和 分页的结果?我们的论文的概要如下。在第2节,我们在解释数据的基础知识在ASP.NET应用程序结合,如何分页 用于切割的开支用于获取和显示 数据和排序的一些字段中的数据。在第3节 我们解释我们的测试环境和 测试方法。测试环境是起诉测量各种ASP.NET的响应时间 它实现各种方法,数据页 抓取和显示。第4节中,我们将解释 结果从试验。在第5节总结了纸并概述进一步研究。2。数据绑定在ASP.NET中的应用当使用像GridView控件ASP.NET数据绑定控件显示数据库中的数据,最快的方法是将数据绑定控件绑定一个数据源控件,该控件连接到数据库并执行查询。当使用这种情况下,数据源控件自动从数据库服务器2得到的数据,并在数据绑定控件中显示它。数据源控件从数据库服务器获取数据的页面生命周期的Page.PreRender事件发生后3Figure 1. Communication between a data-bound control and a database through a data-source control这是一个用于在数据sourcecontrol束缚与数据库中的代码asp:SqlDataSource ID=SqlDS1 runat=serverConnectionString= SelectCommand=usp_autoDataBinding SelectCommandType=StoredProcedure/Following code connects a GridView control with the data-source control.显示在数据绑定控件中的数据的另一种方法是让在页面比如LoadEvent的数据,将其存储在一个数据集对象,然后将数据绑定控件绑定到数据集。我们不expectsignificant两种情况之间的差异在执行时间,因为缓慢的原因的响应时间(显著量传输的数据,没有使用数据库索引等)存在于这两种情况。下面的代码显示在GridView控件如何填充在页面Load方法。SqlConnection connection = new SqlConnection(connString);SqlCommand cmd = new SqlCommand(usp_autoDataBinding, connection);cmd.Connection = connection;cmd.CommandType = CommandType.StoredProcedure;DataSet ds = new DataSet();SqlDataAdapter sda = new SqlDataAdapter(cmd);sda.Fill(ds);DataView dv = new DataView(ds.Tables0);dv.Sort = orderBy;GridView1.PageIndex = pageNumber;GridView1.DataSource = dv;GridView1.DataBind();The variables orderBy and pageNumber are taken from the query string (explained in Section 3). Following stored procedure is used to query the data from the databaseCREATE PROCEDURE dbo.usp_autoDataBindingASBEGINSELECT * FROM testTableEND代码1。查询返回的所有数据从一个数据库当有大量的记录中的网页来显示,这是一种常见的做法,以显示记录只有有限数量的(记录的页面),并允许用户通过记录的页面浏览,即用“数据分页“ 。数据绑定控件如GridView可以使用自动提供的机制,在数据绑定和数据源控件的排序和分页 2 。首先,数据源控件获取数据库中的所有数据(见代码1 ) ,然后将ASP.NET数据绑定控件负责将数据集进行排序并显示只有少数的记录足以装满一个页面。例如,一个数据集可以包含数百万条记录,而这些记录只有10一个网页显示。这种方法提出了两个问题:(一)大量数据库服务器和Web服务器(在一个多服务器部署方案是占主导地位的生产环境)之间传输的数据; ( ii)并无显著消耗CPU和内存资源,以大型数据集进行排序。显然,这些问题对性能和这些问题的冲击伸缩性显著的负面影响可以通过减小通过网络发送的数据量,以及减少资源的消耗被减少。人们需要编写自定义SQL存储过程的排序,并且仅返回将要显示在网页的记录。因此,网络的消耗减少,并且在数据库服务器获取的责任进行排序和页的记录。有很多方法可以实现一个存储过程,可以页面和结果进行排序。我们使用下列操作之一:CREATE PROCEDURE dbo.usp_selectGridViewOrderByIDpageNumber int,PageSize int = 10ASDECLARE Ignore intDECLARE LastID intIF pageNumber 1BEGINSET Ignore = PageSize * pageNumberSET ROWCOUNT IgnoreSELECT LastID = ID from testTable ORDER BY ID ASCEND ELSEBEGINSET ROWCOUNT PageSizeSET LastID = 0ENDSET ROWCOUNT PageSizeSELECT * FROM testTable WHERE ID LastID ORDER BY ID ASC代码2。它支持自定义数据排序和分页SQL存储过程。此存储过程在逻辑上划分的纪录从成大小的记录页面,并返回该记录页面与页码。记录由该存储过程的现场ID解释在字段ID使用索引和索引的类型极大地下令:聚集或非聚集4。通过使用索引的数据结构,我们可以显著提高需要获取信息的预期取决于下列参数的响应时间主要区别时间: l l记录在数据库中数 l l当分页和排序是由ASP.NET完成,或在SQL存储过程 l l数据库索引 l l不同的部署方案。 这些方案基于先前的参数将在我们的测试环境中进行测试。3。测试方法对于我们的测试环境中,我们使用惠普550笔记本采用以下特点: l 处理器:英特尔(R)酷睿(TM)2双核处理器 T54701.60 GHz的 l 内存:2.00 GB l 操作系统:Windows 7专业版32 - 位 l Internet信息服务(IIS)版本7.5.7600.16385 l Visual Studio 2010旗舰 l SQL Server 2008速成版(仅使用1GB内存) 对于测试环境,我们建立了一个网页 应用程序有三个网页 - 一个用于每个 数据绑定,分页和排序的方法 在第2节所述。测试数据库,命名为 testdatabase有一个名为TestTable的一个表。该 数据库中有五个字段。表中的记录是填充了随机的值。网页使用GridView控件来显示从数据库返回的数据。每个网页使用不同的机制来绑定GridView控件与数据,并进行排序和页面的数据。排序字段和页号被传递到网页中的HTTP请求的查询字符串。我们还创建了发送HTTP请求到IIS Web服务器一个Windows应用程序。对HTTP请求的查询字符串中包含一个随机选择的页号,以及排序字段。图2。在测试环境中的HTTP请求我们感兴趣的是处理Web服务器上的HTTP请求所需的时间。请求的页面查询数据从SQL Server表。我们使用ASP.NET跟踪,以确定何时在页面生命周期的某些事件发生时,也就是说,起点和终点在页面处理。启动定时器在Page_Init事件和结束定时在Page_SaveStateComplete事件,这是Page_PreRender事件之后。当请求被发送到ASP.NET ,翻动书页从查询字符串获取变量,因此选择哪个存储过程使用。网页是负责记录在一个文本文件中的响应时间,而这些时间测量后分析。第一页使用自动数据绑定( ADB) 。页面包含一个GridView控件,分页和排序允许的。控制填充了一个存储过程从数据库中获取所有记录作为代码1,第二页填充GridView控件具有相同的存储过程调用的第一个页面,但这次我们填充GridView控件在Page_Load事件处理程序,而不是Page_preRender 事件。第三页之后,会使用一个自定义的存储过程(见代码2)查询结果。该存储过程对结果进行排序的SQL服务器,并且只返回将在该网页显示出来的记录。4。主要结果在图3 - 图5中,我们表明的结果时,该数据表具有1.000.000记录。每一个数字代表前面提到的网页之一,并在每一页有三种类型的结果,这取决于哪个字段被用来对结果进行排序。此时,表TestTable的无指数。每个网页和相应的排序和分页的方法进行试验500次。测量响应时间被分成一小箱数,一般为10的。图本节中给出显示垃圾桶的频率。图3和图4显示的结果时,数据排序和分页在ASP.NET网页使用自动数据绑定执行和,填补了数据中的数据绑定控件在页面Load方法分别。响应时间是非常相似的,符合市场预期。这里的问题方法是将数据源控件需要从数据库中提取1,000,000结果ASP.NET页面之前,可以对结果进行排序。此时该记录不进来预定义的排序顺序,与ASP.NET需要从排序列检查每一个记录的最终结果集可以根据需要进行排序之前。 ID字段是自动递增,这些记录在物理上这个字段在数据库中进行排序。因此,所需的ASP.NET的时间,结果由ID字段设置排序比另外两种更快。通过文本框和输入框订货时的响应时间是不同的,因为它是更快排序整数比文本字段。图5显示的结果时,排序和分页使用SQL存储过程中代码2完成在数据库服务器读者应该注意的是,图5采用图3不同时间尺度和图四与前两种方法相比,响应时间是显著短。究其原因有两方面: (1)该SQL Server是用于大型数据集进行了优化,(2) SQL存储过程返回到ASP.NET网页只有少量的记录足以填满一个网页。在由不同的列排序是由原因造成的,作为图3和图四说明了响应时间的差异接下来,我们重复上面的测试,当有索引的表测试表的。其目的是看在响应时间的差异,聚集和非聚集索引时使用。图6中的表测试表资料是由聚集的ID和字段输入框和文本框有非聚集索引。由于聚簇索引的,由输入框和文本框排序时相比,响应时间按ID排序时,响应时间为显著较小。图中这个模式重复7和图8:响应时间时,由聚集索引的排序是,响应时间由一个非聚集索引排序时短。比较图6,图7和图8和图5可以很明显地,使用任一聚集或非聚集索引提供了显著的改善需要的数据获取时间。索引的存在对当排序和分页在ASP.NET网页中使用守则1 SQL存储过程完成的Web服务器上的响应时间没有影响。结果是相同的,在图3和图4所示。图5-8中的一个奇特的属性是两个峰的存在。当他们出现时进行排序在非索引字段(在图5的所有曲线) ,或与非聚集索引( 输入框和文本框在图6中, ID和输入框在图7中,编号和文本框在图8场) 。这意味着,有两个不同的群体在代码2中的SQL存储过程时的反应。问题出在第二个select语句“SELECT * FROM testTableWHERE ID LastID ORDER BY ID ASC”的代码2 。我们检测到的响应时间要长得多,当输入参数 pageNumber LastID ORDER BY int ASCSELECT testTable.* FROM #tLEFT JOIN testTable ON #t.x = testT代码3。修改SQL存储过程的代码2。“SELECT *” 守则2语句被分解成两部分:第一部分订单被索引字段的记录和存储仅索引字段到一个临时表T。只有 arestored每页记录。没有加入在表TestTable的索引和记录之间进行,因此,执行时间是非常短的第一部分。第二部分加入记录从临时表与recordsfrom原始表TestTable的。由于联接上每页做只记录(如:10条记录),第二部分完成得很快了。图14展示了数量级的改善订单时修改SQL存储从代码3的程序使用。当排序和分页与非聚集索引上做一个字段类似的改进得以实现。5. 结论使用ASP.NET数据绑定控件的默认选项允许排序的快速发展和分页功能。如果一个ASP.NET 数据源控件是用来从数据库中获取所有的数据,然后将数据绑定控件的排序和记录的页面,那么响应时间可以快速地返回的recordset.An SQL存储过程实现规模增长。在SQL Server上的排序和分页的时候应该高性能,资源消耗低,需要使用。它需要较少的时间来fetchthe记录,然后发送到ASP.NET只将bedisplayed的记录。响应时间可如果排序和分页与指数进行现场被进一步降低。最好的结果是实现对聚集索引。6. 参考1 A. Bogardi-Meszoly, G. Imre, H. Charaf,“Investigating factors influencing the response time in J2EE web applications”, WSEAS Transactions on Computers, Vol. 4(2), February 2005, ISSN 1109-2750, pp. 179-1842 MSDN, “ASP.NET Data Access Overview”,/en-us/library/ms178359(v=vs.90).aspx3 M. MacDonald, A. Freeman and M. Szpuszta, “Pro ASP.NET 4 in C# 2010”, ISBN-10: 9781430225294, APress, 2010.4 R. Ramakrishnan, J. Gehrke, “Database Management System”, ISBN-10: 0071230572,3rd Edition, McGraw-Hill Higher Education,2003附件2:外文原文Empirical study of performance of data binding in ASP.NET web applicationsToni Stojanovski, Marko Vukovi, and Ivan VelinovFaculty of Informatics, European University, Skopje, Republic of Macedonia,AbstractMost developers use default properties of ASP.NET server controls when developing web applications. ASP.NET web applications typically employ server controls to provide dynamic web pages, and data-bound server controls to display and maintain database data. Though the default properties allow for fast creation of workable applications, creating a high-performance, multiuser, and scalable web application requires careful configuring of server controls and their enhancement using custom-made code. In providing commonly required functionality in data-driven ASP.NET web applications such as paging, sorting and filtering, our empirical study evaluated the impact of various technical approaches: automatic data binding in web server controls; data paging and sorting on web server; paging and sorting on database server; indexed and non-indexed database columns; clustered vs. non-clustered indices. The study observed significant performance differences between various technical approaches.Index terms web applications, scalability, database access1. IntroductionIn the last few years we are observing increaseduse of web applications. This is a consequence ofmany factors: zero-client installation, server-onlydeployment, powerful development tools, growing user base etc. Furthermore, competition and the quickly changing and growing user requirementscreate a demand for rapid development of web applications. Microsoft Visual Studio (MVS) is the dominant web applications development environment of today. MVS provides numerous mechanisms to support rapid development of ASP.NET applications. Most developers tend to usethe default ASP.NET mechanisms: page caching; introduction of state in HTTP (session, cookies, hidden HTML controls etc.), data management, and the ASP.NET server controls which are arguably the most significant enabler of the rapid development. Though these mechanisms and ASP.NET server controls can significantly decrease the applications “time to market”, at the same time they can reduce performance and scalability of the web application. Analysis of factors which influence the response time of web applications is an active area of research 1.In this paper, we demonstrate the importance of adding custom program logics to ASP.NET server controls in order to improve performance and scalability of web applications. Here we put emphasis on the data binding mechanism, that is, the mechanisms used to maintain and display data. The other mechanism, such as data updating, pag caching, data caching, state management etc. are left for future work.Here we address the following research questions:l What is the impact of the paging mechanism on the response time?l What is the impact of indices on response time when sorting and paging the results?l What is the dependence of the response time on the number of database records?l What are the scenarios when it is better to use ASP.NET server controls? When is it better to use custom stored procedures for fetching, sorting and paging the results?The outline of our paper is as follows. In Section 2 we are explaining the basics of data binding in ASP.NET applications, how paging is used to cut the expenses for fetching and displaying data, and sorting the data by some field. In Section 3we are explaining our test environment and the testing approach. Test environment is sued to measure the response time of various ASP.NET pages which implement various methods for data fetching and display. In Section 4 we explain the results from the tests. The Section 5 concludes the paper and outlines further research2. DATA BINDING IN ASP.NET APPLICATIONWhen using ASP.NET data-bound control like GridView to display the data from a database, the fastest way is to bind the data-bound control with a data-source control, which connects to the database and executes the queries. When using this scenario, the data-source control automatically gets data from the database server 2 and displays it in the databound control. Data-source control gets the data from the database server after the Page.PreRender event in the page life cycle 3Figure 1. Communication between a data-bound control and a database through a data-source controlThis is the code that is used for the data-sourcecontrol to bind with the database.asp:SqlDataSourceID=SqlDS1runat=serverConnectionString=SelectCommand=usp_autoDataBinding SelectCommandType=StoredProcedure/Following code connects a GridView control with the data-source control. Another approach to display the data in a databound control is to get the data in the Page Loadevent, store it in a dataset object, and then bind the data-bound control to the dataset. We do not expectsignificant differences in execution time between the two scenarios, since the reasons for the slow response times (significant amounts of transmitted data, no use of database indices etc.) exist in both scenarios.Following code shows how the GridView control is populated in the Page Load method.SqlConnection connection = new SqlConnection(connString);SqlCommand cmd = new SqlCommand(usp_autoDataBinding, connection);cmd.Connection = connection;cmd.CommandType = CommandType.StoredProcedure;DataSet ds = new DataSet();SqlDataAdapter sda = new SqlDataAdapter(cmd);sda.Fill(ds);DataView dv = new DataView(ds.Tables0);dv.Sort = orderBy;GridView1.PageIndex = pageNumber;GridView1.DataSource = dv;GridView1.DataBind();The variables orderBy and pageNumber are taken from the query string (explained in Section 3). Following stored procedure is used to query the data from the databaseCREATE PROCEDURE dbo.usp_autoDataBindingASBEGINSELECT * FROM testTableENDCode 1. Query that returns all data from a databaseWhen there are a lot of records to display in a web page, it is a common practice to show only a limited number of records (a page of records) and to allow the user to navigate through the pages of records i.e. to use “data paging”. Data-bound controls such as GridView can use the automatically provided mechanisms for sorting and paging in databound and data-source controls 2. First, the datasource control gets all the data from the database(see Code 1), and then the ASP.NET data-bound control is responsible to sort the dataset and display only a small number of records enough to fill a page. For example, a dataset can contain millions of records, and a web page displays only 10 of these records. This approach poses two problems: (i) lots of data is transferred between the database server and the web server (in a multi-server deployment scenario which is dominant in the production environment); (ii) there is significant consumption of CPU and memory resources to sort large datasets. Clearly, these problems have significant negative impact on the performance and scalability of the application.The impact of these problems can be reduced by decreasing the amount of data sent through the network, and reducing the consumption of resources. One needs to write a custom SQL stored procedure which sorts and returns only the records which will be displayed in the web page. Thus, the network consumption is reduced, and the database server gets the responsibility to sort and page the records. There are many ways to implement a stored procedure that can page and sort the results. We are using the following one:CREATE PROCEDURE dbo.usp_selectGridViewOrderByIDpageNumber int,PageSize int = 10ASDECLARE Ignore intDECLARE LastID intIF pageNumber 1BEGINSET Ignore = PageSize * pageNumberSET ROWCOUNT IgnoreSELECT LastID = ID from testTable ORDER BY ID ASCEND ELSEBEGINSET ROWCOUNT PageSizeSET LastID = 0ENDSET ROWCOUNT PageSizeSELECT * FROM testTable WHERE ID LastID ORDER BY ID ASCCode 2. SQL Stored procedure which supports custom data sorting and paging.This stored procedure logically divides the records from tabletestTable into pages of size pageSize records, and returns the records frompage pageNumber. Records are ordered by field ID.Performance of this stored procedure greatly dependson the use of index on field ID and the type of index: clustered or non-clustered 4. By using indexed data structure w

温馨提示

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

评论

0/150

提交评论