How to set up a load/stress test for a web site? [

2019-03-13 08:48发布

问题:

I've been tasked with stress/load testing our company web site out of the blue and know nothing about doing so. Every search I make on google for "how to load test a web site" just comes back with various companies and software to physically do the load testing.

For now I'm more interested in how to actually go about setting up a load test like what I should take into account prior to load testing, what pages within my site I should be testing load against and what things I'm going to want to monitor when doing the test. Our web site is on a multi-tier system complete with a separate database server (IIS 7 Web Server, SQL Server 2000 db). I imagine I'd want to monitor both the web server and the database server for testing load however when setting up scenarios to load test the web server I'd have to use pages that query the database to see any load on the database server at the same time.

Are web servers and database servers generally tested simultaneously or are they done as separate tests?

As you can see I'm pretty clueless as to the whole operation so any incite as to how to go about this would be very helpful.

FYI I have been tinkering with Pylot and was able to create and run a scenario against our site but I'm not sure what I should be looking for in the results or if the scenario I created is even a scenario worth measuring for our site.

Thanks in advance.

回答1:

Check out JMeter. I found it a little tricky to get started with but once you have your tests setup it's easy to run. They have a tutorial on how to setup distributed testing here.



回答2:

Generally speaking load tests will run through common scenarios with various user loads.

So for example, you might set up a test wherein 50 users login every second for 10 minutes and another where the number starts at 5 users/second and scales up to 1000 / second or whatever numbers make sense for your your site.

edit:
The idea is to test how your actual application behaves when in use across all tiers.
If you are going to be load testing, definitely invest (time and or $) in a good tool.



回答3:

Here's a listing of tools that will help get you started with this. You're right to want to read up on it first, stress testing can get complicated.

http://www.softwareqatest.com/qatweb1.html



回答4:

Step number 1 for an existing site or a replacement for the same is to gather and analyze. Statistics.

No point in first modeling predictions if they are outside the central limit. (They will come out in a rigorous approach anyway)

And in all cases, you should be working in concert with someone from the NOC. Reasons are too obvious and the thread here that supports a hero approach is not good for your company; especially as you will be learning as you go. Not to say that you can't be a hero, but NOC's are notoriously belligerent to performance numbers that are dropped in their lap in a decision making meeting.



回答5:

First, get a web-stressing tool like Neoload.

Model a number of user activities and bias your test to correspond to predicted user patterns, then scale load up as you see fit. Running queries against the database and measuring response time tells you nothing about user experience. Rather, by modeling user activities, you can gauge exactly how your server/system will respond under real load, as that's what you'll be generating.

User activity modeling can get pretty complex, but good stress tools like Neoload let you closely model the exact behavior of any machine hitting your server. Ideally, you would craft network traffic just as you would normally, so make sure to hit your load balancer if you've got one.



回答6:

I found Visual Studio Test edition easier to test with (though it is not free). You can record a browsing session as a single test and it will allow you to read the perfmon stats from both your webserver and database easily enough.

The first step you should take is to look at your IIS logs to find out what is going on there. Log Parser 2 is the tool I would use should get the IIS logs into a database.

Querying that will give you an idea of peak load.

Next step is to formulate a goal or two for the testing. Do you need to make sure the website is able to handle spike loads on a single page or two of X requests per second?

Are you intending on increasing the customers of the site, in which case take the current IIS log load and forumlate webtests that can simulate that range of page requests, but load for the expected concurrent users.

If you are intending to change functionality on the site, you can do a baseline loadtest and compare the performance after any changes to the site.

The real goal in load testing is to prove that the application and hardware are able to handle a target load that the business finds acceptable and still returns pages within a reasonable time.



回答7:

As you can see by the answers to this question, there are lots of programs available for load testing. In my experience I have found Siege to be my personal favorite. Its simple, provides most of the options needed to do load testing. Here is an example usage:

seige -c 10 -t 1M http://www.google.com

This will send 10 concurrent requests to google.com for 1 minute. If you want to test more than one page you can also provide a file which contains a list of urls.

Note that a tool like seige is appropriate when you have a single or set of urls that you would like to test. If you want to test more complicated flows (e.g. user logs in, submits entry, logs out) then you will want to use something like selenium.