如何计算TPS
我必须用 java 构建一个应用程序,它将处理特定应用程序的负载测试。在这里我们可以给出某些参数,例如 TPS(每秒事务数)时间(以秒为单位)和请求数。我给你一些场景,比如 TPS = 5 时间=100 请求数量=500。 或者 TPS=10 时间=100 请求数量=1000
但是我使用多个线程发送了这个请求,因此该进程可以满足并发事务的填充。我的问题是如何创建逻辑来创建它。我正在用java开发我的程序。
I have to built an application in java which will handle load testing on a particular application. Here we can give certain parameters like TPS (Transaction Per Second) Time (in secs) and Number of Request. I am giving you some scenario like
TPS = 5 Time=100 No of Request=500.
Or
TPS=10 Time=100 No of request=1000
But this request I have sent using multiple Thread so the process can give the fill of concurrent transaction. My question is how to create the logic to create this. I am developing my program in java.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您想以 50 TPS 的速度运行 100 秒。您可以有 5 个线程,每 100 毫秒发送 1 个事务,持续 100 秒。但是,您希望稍微随机化进程,以防止线程同时发送事务。因此,每个步骤的流程将是
这将为您提供合理分布的平均时间 50 TPS。您可以使用线程数和其他数字来实现您的特定目标。
Suppose you want to run 50 TPS for 100 seconds. You can have 5 threads that would send 1 transaction every 100 ms for 100 seconds. You,however, want to randomize the process little bit to prevent threads sending transactions at the same time. So the process for each tread would be
That will give you average 50 TPS reasonably distributed in time. You can play around with thread count and other numbers to achieve your specific goal.