0

我写了一个小程序来测试我的服务器的性能。该程序每秒向服务器发送 100 个请求,并测量接收答案所需的时间。测试程序是用 Java 编写的,每个请求都由一个单独的线程处理。请求已编号。该数字由服务器退回,以便客户端程序知道哪个请求得到了响应。我得到的结果到处都是问题。有时回复需要一秒钟,有时需要 3 秒钟,有时需要 10 秒钟。我无法理解它。为什么会这样?如果我做错了什么,那么测试我的服务器的更好方法是什么?

编辑了解更多信息。该服务器是一个 Amazon Elastic Beanstalk 应用程序。它在 5 个 EC2 实例的集群上运行。它运行一个简单的程序,在发送包含它在请求中收到的数量的响应之前执行一些循环。客户端在发出每个请求时对其进行计时,并将其与收到相应回复所花费的时间进行比较。

编辑 2 测试运行 30 分钟,输出是所有时间的平均值。我在请求之间得到了截然不同的结果,但个人平均值之间的差异也很大。

4

4 回答 4

1

如果您正在检查网络服务器的性能,您可以使用网格。

此页面上的更多信息http://grinder.sourceforge.net/

于 2013-09-11T18:37:22.247 回答
0

I think what you are trying here is a load testing. It might be possible that depending on nature of data, the processing time is varying. e.g. Say, your server is parsing an XML, so depending on the size of XML data, it could take different time in responding.

I could also depend on, if there is a network call (to say a DB call or webservice call), so depending on the 3rd party response and network performance, the result could vary.

I believe your way of testing the server performance is still ok, as long as you are testing with wide range of possible data, boundary conditions and different process flow (based on business logic).

Other way is to setup an automated load testing using some tool; but that would be a good effort based on nature of the application and type of data.

于 2013-09-11T18:39:46.023 回答
0

Where is your server located? If it is hosted somewhere remotely, then a number of thing can happen: the load on the same machine that hosts your server might vary, the network speed might vary. Also since you are bombarding your server with 100 request/second, it might be quite heavy work. Depending on many things like waiting for a shared critical resource, the respond time supposed to be varied like that. It short, without knowing the nature of your server, we do not know for sure.

What I would make out of it is that with a load of 100 request/second, your server seems to have a 10 second response in the worst case scenario. You can calculate the average time also...

于 2013-09-11T18:39:58.300 回答
0

好吧,您的互联网连接速度可能会有所波动,尤其是当您将它们用于其他用途时。您的服务器也是如此。这就是为什么 ping 不是一个恒定的东西。由于流量变化而导致的任何服务器端操作都可能会影响时间。你的方法应该没问题。

于 2013-09-11T18:36:42.327 回答