---
title: "关于性能测试中一些计算方法(throughput, active user...)"
author: "willpower"
date: "2008-10-08T14:33:54Z"
tags: []
slug: "throughput-active-user"
draft: false
lastmod: "2008-10-08T14:33:54Z"
id: 250317
url: "https://willpower.iteye.com/blog/250317"
---

我们知道最简单的情况下有如下公式：

 

Throughput = 1 / responseTime       (1)

 

现实情况是用户在提交一个请求后并不会立即发第二个请求，比如用户打开一个页面后，他可能会花些时间来浏览它，我们把这个时间叫思考时间：ThinkTime, 那么公式(1)则进化为：

 

Throughput = 1 / (thinkTime + responseTime)        (2)

 

以上公式是在单用户的情况下， 多用户下还要引入活动用户(active user)的概念,公式(2)进化为：

 

Throughput = activeUserNumber / (thinkTime + responseTime)        (3)

 

如何知道系统的最大Throughput?

1&gt; think time 为 0

2&gt; CPU 利用率最高

 

系统可以支持多少个在线用户(active user)？

根据公式(3)可以得到

maxActiveUserNumber = maxThroughput * (thinkTime + responseTime)

且因为一般情况下thinkTime &gt;&gt; responseTime, 又可得到:

maxActiveUserNumber = maxThroughput * thinkTime

这样我们只要知道用户的thinkTime, 就可算出最大可支持的用户数.