我应该对托管网站进行负载测试吗?如何?

发布于 2024-10-07 09:29:41 字数 133 浏览 11 评论 0原文

构建网站或应用程序时,最佳实践是对其进行负载测试,以确保其能够处理生产负载(使用 HP LoadRunner、RadView 的 WebLOAD 等工具)。

如果应用程序托管在外部,我该怎么办?我可以对其进行负载测试吗?我应该吗?如何?

When building a web-site or application, it is best practice to load-test 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

随遇而安 2024-10-14 09:29:41

简短的回答:是的,您应该进行负载测试。

更长的答案:您应该尝试在测试中复制生产环境。它不需要完全相同,但您应该尝试尽可能接近,特别是在软件环境和物理内存方面。 CPU 速度对于复制来说不太重要(只要它相当相似),但您可能希望保持正确的 CPU 数量。尝试使磁盘速度尽可能接近生产环境,因为这可能是一个重要的瓶颈。除非您进行大量写入(临时或永久),否则磁盘空间并不那么重要。

然后,您可以在将测试环境投入生产之前对其进行负载测试。这将使您了解您的应用程序将处理多少负载。您的测试环境与生产环境越相似,您的结果就越有意义。

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.

还不是爱你 2024-10-14 09:29:41

您使用的是共享主机帐户吗?然后您需要先联系您的托管公司,因为您可能会关闭其他网站(拒绝服务攻击......)

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...)

海夕 2024-10-14 09:29:41

这是最佳实践吗?是的,绝对是。

如果应用程序托管在外部,我该怎么办?我可以对其进行负载测试吗?我应该吗?

是的,你可以,是的,你应该。

如何?

在过去几年中,随着廉价的按小时计算的计算机租赁(即 EC2 等云供应商)的出现,这变得更加容易。寻找支持从云生成负载的工具。如果您有一个内部系统要测试,您应该从那里开始 - 在这种情况下,您将需要选择一个允许内部和外部测试的测试工具(仅限云的负载测试服务通常不允许)。

我将与其他答案之一以及传统答案相矛盾,我说您绝对应该尽可能测试您的生产系统。在理想的情况下,你会有一个完全相同的系统进行测试,因此只有在测试系统完全满足性能要求之后才会进行生产测试——此时主要是走个形式——以确保生产环境中的一切都正常。配置正确(您会惊讶地发现“相同”的测试/生产系统经常不相同!)。但在现实世界中,完全重复的测试系统并不总是可行或实用的。我们定期测试客户的生产站点 - 事实上,除了在开发和功能测试期间使用的单服务器系统之外,我们的客户很少有测试系统。这并不理想,但相当可行。

至于一般过程 - 从一些最关键的用户场景(测试用例)开始,然后:

  1. 构建并验证测试用例
  2. 运行测试并分析结果
  3. 优化/调整系统,直到满足性能目标
  4. 扩大范围并重复1-3,根据您的日程/预算允许。

尽量不要陷入“完全正确”模拟测试用例的细节中——尤其是在早期。任何负载测试都只是实际使用情况的近似值 - 每天(或每小时)的实际使用情况都是独一无二的。花在让一个测试用例“恰到好处”上的时间不是花在测试其他 15 个也应该测试的测试用例上的时间。我们在我们的博客上还有一些其他文章,可能会对您有所帮助开始吧。

祝你好运!

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:

  1. Build and verify the testcases
  2. Run a Test and analyze the results
  3. Optimize/Tune the system until it meets the performance goals
  4. 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文