How to do performance testing-response time

Source: Internet
Author: User

Performance testing first to understand the performance,response times (response time) as one of the two important indicators in the performance testing process, we must pay attention to.
from the user's point of view, users hate waiting. In a large number of processing environments, more than 3 seconds of response time will have a serious impact on productivity. However, the end user's perception is not just an absolute time problem, their expectation of response time is based on previous experience, which is relative to the benchmark performance they use for the application. If the current feeling of using the app differs greatly from previous experience, the number of complaints and calls that need support will multiply. response time is both objective and subjective for users.
Example (1):for the novel website, the main function of the page is to provide users with readable content, then the user is likely to "novel content" this time as the response time they feel;Example (2):for the tax filing system, the main function of the page is to provide the user to declare the tax page, then the user only open the declaration page, the declaration of tax success, will feel the page response is completed. For example (1), the novel content can be completely segmented loading, loading 500 words, wait for the previous 500 words after loading, then load after the content, when reading a certain content, the user does the mouse scrolling or paging operation when the content after loading.        For example (2), the declaration of tax needs to wait, server processing, database processing, External system communication, browser front-end loading and so on after the completion of the process, can be counted as a response success. For example (1) The response time can be interpreted as "The time spent by the application system from the start of the request to the response received by the client. For example (2), the response time is defined as "the time it takes the application from the start of the request to the last byte of data received by the client." The reason for this difference is that some techniques can be used to render when the data has not been fully received to reduce the user's perceived response time. A brief composition of the page response time for the web app. As you can see, the service-side response time of the page can be decomposed into network transfer time (N1+N2+N3+N4), Application processing time (T1+T3), Database processing time (T2), and front-end browser load time (T4). The main purpose of this subdivision of response time is to be able to locate performance bottlenecks more accurately.

  • N1&n4
At this stage the user clicks on the page, establishes the connection using the HTTP protocol, makes the getRequestor postrequest. An HTTP connection is actually a TCP connection and some rules for using connections. A TCP connection is a reliable connection on the Internet. (Detailed TCP protocol knowledge, see "The things about TCP (UP) "Http://coolshell.cn/articles/11564.html, theWhat's happening with TCP (bottom)Http://coolshell.cn/articles/11609.html)TCP provides a reliable bit-transport pipeline for HTTP. The bytes that are filled in from one end of the TCP connection are transferred from the other side in their original order and in the correct way.

    • N2&n4
JDBC (Java Data Base Connectivity,java database connection) is a Java API for executing SQL statements that provides unified access to a variety of relational databases, consisting of a set of classes and interfaces written in the Java language. JDBC provides a benchmark to build more advanced tools and interfaces that enable database developers to write database applications. In short, JDBC can do three things: establish a connection to the database, send a statement that operates the database, and process the results.
Database connections are typically managed through a connection pool, and when a query statement in the connection pool finishes executing, the connection that the connection pool obtains is not immediately released, but waits for the next query to call the connection. Because establishing a connection is also an extremely time-consuming operation.

    • T1&t3
Java servlet as a thread-safe server program(note: The thread safety described here does not guarantee that the business code that the developer does is also thread-safe), almost all Java Web applications are developed on this basis. (Of course, you can also use Java to implement a set of CGI, as for what is CGI, see Http://baike.baidu.com/subview/32614/12037322.htm?fr=aladdin)
    servlet life cycle
    1. < Span style= "BACKGROUND-COLOR:INHERIT; line-height:1.5; " >    client requests the servlet 
    2.     Load servlet class to memory  
    3.     Instantiate, initialize the servlet 
    4.     init () initialize parameter  
    5.     Service () (Doget () or Dopost ())  
    6.     Destroy ()  
loads and instantiates a servlet. This operation is typically performed dynamically, and in middleware such as WebLogic, the number of servlet concurrent threads can be configured, while the number of servlet concurrent threads can be monitored. The server typically provides an administrative option to force the loading and initialization of a specific servlet at server startup. server creates an instance of a servletthe first client's request arrives at the serverThe server calls the servlet's init () method, which can be configured to be called when the servlet instance is created by the server, in the Web. XML <servlet> tab under configuration <load-on-startup> tags, The configured value is integer, the smaller the value, the higher the servlet's boot prioritya client request arrives at the serverserver creates a request object that handles client requestsserver creates a response object that responds to client requestsServer activates the service () method of the servlet, passing the request and response objects as parametersThe Service () method obtains information about the requested object, processes the request, accesses other resources, and obtains the required informationThe Service () method uses the method of the response object to pass the response back to the server, eventually reaching the client. The service () method may activate other methods to process the request, such as doget () or dopost () or a new method developed by the programmer himself. For more client requests, the server creates a new request and response object, and still activates the servlet's service () method, passing the two objects as parameters to it. This repeats the above loop, but does not need to call the Init () method again. The generic servlet is initialized only once (only one object), and when the server no longer needs the servlet (typically when the server shuts down), the server calls the servlet's Destroy () method.

    • T2
The database system will process a few steps to this SQL before executing and fetching the results: when a SQL or a/PL command is published, Oracle automatically looks for the command to exist in the shared pool to determine whether to use hard parsing or soft parsing for the current statement. Typically, the SQL statement executes as follows:
  1. Syntax of SQL code (correctness of syntax) and semantic checking (existence and permissions of objects).
  2. Hashes the text of the SQL code to get a hash value.
  3. If the same hash value exists in the shared pool, the command is further judged if it is soft-resolved, otherwise, to 5 steps.
  4. for a new command line that has the same hash value, its text is compared one by one with the text of the command line that already exists. These comparisons include case, string consistency, whitespace, comment , and so on, and if it is consistent, soft-parse it, and go to step 6. Otherwise to 4 steps. Red font Description error should go to step 5
  5. Hard parse to generate execution plan.
  6. Executes the SQL code and returns the result.
Soft parsing finds the same or similar SQL statements in the buffer that can be used directly without having to re-parse the execution plan. Hard parsing is the opposite,that the entireSQLexecution of the statement requires complete parsing to generate the execution plan. While hard parsing, generating an execution plan requires consumingCPUResources, andSGAResources. Not hereThe use of latches in the library cache is not to be mentioned. The latch (latch) is a refinement of the lock, which can be understood as a lightweight serialization device. These latches are used to secure shared memory when a process has requested a latchthe number will not be modified by more than two processes at the same time. In the case of hard parsing, the use of the latch needs to be applied, while the number of latches waits in limited cases. The use of a large number of latches thusThe more frequently the processes that need to use the latch are queued, the performance is over-lowered.  The database uses the internal hash algorithm to obtain the hash value of the SQL, and then finds out whether the hash value exists in the library cache. If present, compare this SQL with the cache. Assuming "Same", the existing parse tree and execution plan are used, and the work of the optimizer is omitted. This is also the soft parsing process. (For the implementation plan, see http://www.cnblogs.com/snifferhu/p/3461982.html)

    • T4
The front-end page contains HTML, images, CSS, JS, flash and other elements, for various elements due to different browser versions, resulting in different loading order. For front-end page loading this piece of research is not very deep, it is recommended to see "Javascript Loading and execution" http://coolshell.cn/articles/9749.html

SummaryThe concept of response time and the composition of response time are described here, and the response time is the beginning of the performance test.

How to do performance testing-response time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.