Use rest assured to perform a load test for your ASP program

Source: Internet
Author: User
Tags servervariables webcat

 

Use rest assured to make a load test article for your ASP program source: Internet Author: Edit and organize published on: 2008-06-02 add to QQ bookmarks

Introduction
When we switch from a traditional CS-structured application to a popular web space program, we find that we are trying to keep up with the increasing demand for testability and performance. One of the biggest challenges is how to determine the maximum number of users your program can support. How do you face this challenge? Setting clear performance goals and using web stress testing tools is a good start.

This article will introduce how to perform stress testing on your ASP program and Microsoft's stress testing tool-web application stress test tool (was ). in the next chapter, you will learn the basics of stress testing and some necessary skills, you will be able to test and modify your program more effectively based on the test results.

Plot
Suppose you want to publish an ASP program that is expected to be used by 1000 users. You know clearly that your program can handle access by at least two concurrent users, because you and your partners can click this ASP program all the way without any problems. You are wondering whether two users can accurately reflect the pressure on your program. Of course, you can use standard testing methods (publish your program and expect the best results), but you still decide to test the performance of your program in advance. This is a good sign!

Test requirements
To better test your ASP program, you must first determine how much pressure your program will face in the future. Simply put, the pressure or load can be divided into the following figures:

· The minimum number of users. (What is the minimum number of users of this program? Generally, this value can be a daily, weekly, or monthly click volume. Of course, you can also split it into a more controllable value-hourly access volume ,)

· Total number of concurrent users (what is the worst condition at the peak? Make corresponding plans and hope to work normally under pressure .)

· Request peak value. (How many ASP pages are generated per second? This may be the most important factor in measuring the ability of an ASP program to respond to user requests .)

It is usually difficult for your program to determine the number of users and the number of concurrent users, and before your program is actually used. Especially network programs. Even LAN programs often have to deal with the increasing number of users, so it is difficult to accurately predict the number of users. When you don't know how to start, you 'd better start with the basics:

Internet considerations:
· Analyze your existing IIS logs. This value implies some actual probabilities.

· How popular will your website be? Popular sites have 1 million or more visits a day. Not so popular? What are the differences? Suppose you have more than 1000 user groups? Can you solve the scalability problem by adding more hardware devices? Or will your program architecture become a bottleneck?

· What is the worst case? Could this happen to your friends?

Intranet:
· Analyze your existing IIS logs.

· Can this ASP program be used by everyone? How many machines are there on the company's Intranet? Can your system administrator tell you about peak network traffic?

· Does this program have specific user objects? Only HR Human Resources Department? How many employees are using the Human Resources department?

· What is the worst case?

If you cannot determine the appropriate load in advance, determining the maximum limit of your program will be your best choice. How many ASP response results can you generate within one second if you are clicked by 10 users? What about the 100? What about the 1000? What about the 10000? Record your benchmark. When you get your traffic logs from actual use and show that you are approaching your limit, you will not only know your current limit, and you will have time to prepare a solution.

Introduction to the test tool was

Although there are many stress testing tools to choose from, I will focus on was (formerly known as Homer) in this article. was is the current Microsoft standard web page stress testing tool. If you are familiar with webcat, you will be excited to find that was can easily import existing webcat scripts. If you have used inetmonitor before, you will be excited to find that was is also based on GUI (this will be a good additional feature for many webcat users who use command line ). Another advantage is that it is free. A good friend of mine often says, "If it is free, it is mine ." In addition to its price advantages, this tool also provides complete functions and is continuously being upgraded and updated. Microsoft.com is often used, so they will understand the importance of this tool.

But you don't need to talk too much about me, just try it on your own. I will provide a list at the end of the article to list some third-party stress testing tools. You can decide what tools to choose. The bottom line is that you need a tool to put your ASP program under load and test it before release.

Start using was
I will teach you how to use this tool for the first time to test an ASP page. I will also introduce how to use the signed login test and multi-user concurrent access test, because these things will make beginners confused.

First, you need to download and install this tool. You can get the latest version from the link below

Http://www.microsoft.com/technet/treeview/default.asp? Url =/technet/itsolutions/Intranet/downloads/webstres. asp. You can go back to this website to get started with this tool.

Note the following points during installation:

· Do not install was on your testing target server and other machines to ensure accurate test results are obtained.

· Ado2 is required on the machine where was is installed. 1 or later versions. If oledb32.dll is not 2.10.3711 or later, ADO is automatically installed by was.

· After installation, you will have a complete installation log, which will be stored in/program files/Microsoft Web application stress tool/install. log by default.

· If you have installed the old version of was, the data file will be kept intact during the update. Was uses the access. MDB file as the data storage file. The initial. mdb package of was is was. mdb, which can be found in the program installation path.

· Was stores registration information in the Registry's HKEY_LOCAL_MACHINE/software/Microsoft/was.

Before running the newly installed was, we create a simple ASP script as the test page. Create a new ASP page named myasppage. asp and insert the following script:

Myasppage. asp
<% @ Language = VBScript %>
<HTML>
<Body>
<% Const forappending = 8
Set ofso = server. Createobject ("scripting. FileSystemObject ")
'Translate our virtual directory into a physical path
Strfilepath = server. mappath (request. servervariables ("path_info "))
'Grab the root of the virtual directory
Strfilepath = left (strfilepath, (Limit Rev (strfilepath ,"/")))
Strfilepath = strfilepath & "myfile.txt"
'Write out to the screen the full file path
Response. Write (strfilepath & "<br> ")
Set OTs = ofso. opentextfile (strfilepath, forappending, true)
Ots. writeline ("session ID:" & session. sessionid & CHR (32 )&_
"Time:" & CSTR (now ()))
%>
</Body>
</Html>

This ASP script inserts the sessionid and its activity time in a text file, so that we can easily confirm whether our ASP page is correctly executed. Once you are familiar with this tool, you can point to your actual ASP page for real testing.

Place your ASP page in the appropriate directory on the server so that it can be accessed anonymously. We will try the signature access test later, but now we need to run a basic test. Use a full-path URL to browse your page, including your server name. For example, a complete URL looks like http: // myserver/myvirtualdirectory/myasppage. asp. One day you can successfully view your asppage (check the myfile.txt file, which will be written by the program in the physical location of the virtual directory), you can run was for actual testing.

When you run was for the first time, the following dialog box appears:

Figure 1. Create a new script

Although other options are attractive, we should select manual first. In the future, you can create a new script from the scripts of the menu or the new script icon in the tool bar.

Welcome to the script browsing interface. The left-hand window lists your scripts in a tree structure. In the right-hand window, you can modify your script settings.

Click new script in the tree list in the left-hand window to activate the browsing of the script. Enter the name of your server in the server input box. In the first item of the script item, select get as your action. Enter your asp address in path, starting with a virtual directory. See Figure 2 below:

Figure 2. Enter the URL in the path field

At this time, you can click the run script arrow symbol on the toolbar to execute your script (make sure you have obtained the correct script in the left window ). This script takes about 1 minute to run before a summary performance report is generated.

Analyze test results
You can click the reports icon on the toolbar to view the generated report. This generates a new tab corresponding to the script tab. Reports are stored in an outline view. First, click "result codes" in your report. This will give you a quick impression on whether there is any problem in this test. If the status code you see is not 200, you may need to investigate what is wrong. The common problems include the signature and incorrect URL path.

Click overview. You will see a brief and quick analysis of this test activity. From the perspective of ASP technology, request per second is a key value that requires in-depth analysis. The higher the value, the better. Generally, if you cannot determine a specific goal from the Use report and budget, you can set ASP's requests per second value to higher than 30, of course, this ASP does not connect to the database or use other components. It is foreseeable that connecting to the database will increase the burden on the program.

Although the request per second counter is included in was by default, you may want to add other counters. You can click the perf counters icon and add counter to add other counters. A particularly useful counter is ASP requests queued, which is often the key to identifying a blocked or long-lived page or component. Resources for analyzing ASP performance include:

· Tuning Internet Information Server Performance

· Navigating the maze of settings for Web server performance optimization

· IIS 4 Resource Kit

Factors Affecting Performance and testability
Server composition, database access, and other factors will greatly reduce the ASP request per second value. Different configuration options also play different roles. Here I want to point out several common factors:

· If you are accessing a database, do you have a connection pool? For more information about the connection pool, see pooling in the Microsoft Data Access Components.

· Are you using ASP session variables to store the status? Session variables will soon affect testability. They need server resources, and if you want to increase the number of machines to expand the performance, they will be blocked because the session is connected to a specific machine. Stateless is the method to maximize scalability. For more information about session substitution, see HOWTO: persisting values without session.

· Do you store Visual Basic components in the session state? Remove them now. The Visual Basic object in the session will cause thread relevance and interfere with the thread pool of IIS. This is a complex topic, but the experience is: do not store single-threaded apartment (STA) objects in the session. If you need to keep objects in the session, they should be marked as "both", and you need to aggregate these free threads into a set by yourself. Active Template Library (ATL) can create such a monster.

· Is your network program restricted to running in its own memory? In fact, we recommend process protection. However, if you need to squeeze out some extra performance, running your network program in the process will save some overhead of the Cross process set.

· When Microsoft Transaction Server (MTS) components are involved, if the component runs as a server package rather than a library package, there will be significant performance differences. A common suggestion is to set the network program to run in its own memory space, and then run the MTS component in the library package.

Simulate multiple users
I will briefly introduce how to simulate multi-user requests in was. You need to do two things:

1. Change concurrent connections on the settings panel.

2. Create users in users at least to create more users than you specified in concurrent connections.

To change the number of concurrent users, click the settings icon. If there are less than 100 users, you can directly set the stress level. To simulate more than 100 users, you must also set the stress multiplier. The basic formula is: Number of users (number of threads) = stress level * stress multiplier. To simulate 1,000 users, you can set the stress level to 100 and the stress multiplier to 10.

If you try to run the script before setting enough users, you will get a warning. Click the Users icon to modify the number of users. You will see a default group in the window on the right. Double-click the default group to expand your user list. If anonymous access is allowed, simply enter the code of the new user and click Create.

Run the test that requires signed logon.
If you want to run the page that requires signed logon, you need to create a suitable user name and password so that was can be used at runtime. This is also set in users. You can remove the current user list by removing all from the beginning, and then add the user you need. You can also choose to import the user name and password from the text file.

However, you must ensure that these users have valid accounts and can access the IIS server. If you are using a basic user account, you can test this account by submitting a certificate in your browser and writing a request in a text file. servervariables ("auth_user") is helpful. The modified ASP code will look like this:

Ots. writeline ("session ID:" & session. sessionid & CHR (32 )&_
"Time:" & CSTR (now () & "auth User:" & CHR (32) & request. servervariables ("auth_user "))
Tips for using was
At the end, I will provide some tips and some experience to summarize:

· Adjust the storage of log files on your website because the file will increase rapidly (see the IIS Documentation)

· By setting the DWORD of HKEY_LOCAL_MACHINE/software/Microsoft/was/sessiontrace in the Registry to 1, you can track was activities through debugging.

· If your was report shows an error, check the event log, browse your page in the tool's external browser, and then check the server log:/winnt/system32/logfiles/w3svci

· If your testing client machine's processor usage exceeds % 85, you may need to add more testing clients

· More interesting topics will appear in was documents: page groups, query strings, cookies, web application stress object model and Active Server Page client (this will allow you to remotely control the test client through web)

Please note that this is a tool without technical support and sends your issue to the webtool@microsoft.com. You can search for common problems on the Web application stress tool. You can also program the tool and reference the object model on the same website.

Resources
To get more information, tutorial on the was website is a good place. Of course, please read the online help that comes with was-especially a topic called web stress testing overview.

· Webhammer. A tool used by serverobjects to test network programs and servers

· LoadRunner. A stress testing tool by Mercury Interactive that can be used to predict the system performance and performance of enterprise-level programs

· Enterprise monitor. Released by mediahouse software for monitoring, reporting, and restoring your intranet and Internet networks

· Extreme soft's perfmon. Tools for Microsoft Transaction Server provide direct MTS monitoring from performance monitoring.

J. D. Meier was born and grown on the East Coast of the United States. Since paying attention to Greeley's suggestions, he has become a development support engineer focusing on server components and Windows DNA applications involving MTS and ASP technologies.

Related Article

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.