When building a web-site or application, it is best practice to load-te开发者_开发问答st it to ensure it can handle the production load (with tools like HP LoadRunner, RadView's WebLOAD).
What do I do if the application is hosted externally? Can I load-test it? Should I? How?
The short answer: Yes, you should load test.
The longer answer: You should attempt to replicate the production environment in test. It doesn't need to be exactly the same but you should try to get as close as possible, particularly in terms of software environment and physical memory. CPU speed is less important to replicate (as long as it's reasonably similar) but you probably want to keep the number of CPUs right. Try to keep disk speed as close to the production environment as possible because this can be a significant bottleneck. Disk space is not nearly as important unless you're doing lots of writes (temporary or permanent).
You can then do your load testing on your test environment before putting it into production. This will give you an idea of how much load your application will handle. The more similar your test environment is to the production environment the more meaningful your results will be.
Are you on a shared hosting account? Then you need to contact your hosting company first, as you might bring down other websites ( denial of service attack...)
Is it best practice? Yes, absolutely.
What do I do if the application is hosted externally? Can I load-test it? Should I?
Yes you can, and yes you should.
How?
That has become much easier in the past few years, with the availability of cheap hourly computer rentals (i.e. cloud vendors such as EC2). Look for tools that support generating load from the cloud. If you have an internal system to test on, you should start there - in which case you will want to choose a testing tool that allows both internal and external testing (cloud-only load testing services typically do not).
I'm going to contradict one of the other answers, as well as the traditional answer, by saying that you absolutely SHOULD test your production system whenever possible. In an ideal world, you would have an identical system for testing, so the production test would be done only after the test system fully satisfies the performance requirements - at this point it is mostly a formality - to ensure that everything in the production environment is configured correctly (and you'd be surprised how often "identical" test/production systems are NOT identical!). But in the real world, a full duplicate test system is not always possible or practical. We test our customers productions sites on a regular basis - in fact, very few of our customers have test systems, beyond a single-server system used during development and functional testing. It is not ideal, but quite workable.
As for the general procedure - start with a few of the most critical user scenarios (testcases) and then:
- Build and verify the testcases
- Run a Test and analyze the results
- Optimize/Tune the system until it meets the performance goals
- Expand the scope and repeat 1-3, as your schedule/budget allows.
Try not to get bogged down in the details of simulating the testcases "exactly right" - especially in the early going. Any load test is merely an approximation of real-world usage - every day (or hour) of real-world usage is unique from any other. Time spent getting one testcase "just right" is time NOT spent testing the other 15 testcases that should be tested as well. We've got some other articles on our blog that may help you get started.
Good luck!
精彩评论