Microsoft SQL性能计数器更新率

时间:2022-03-12 23:08:15

I try to get the TPS of an MSSQL database.
I'm using this query to retrieve the performance counter values:

我试图获得MSSQL数据库的TPS。我正在使用此查询来检索性能计数器值:

SELECT * 
FROM sys.dm_os_performance_counters
WHERE OBJECT_NAME = 'SQLServer:Databases'
AND counter_name = 'Transactions/sec'
AND instance_name = 'DB_NAME'

But the update rate is very low. Once a minute or so.
Also it says "Transactions/sec" but the value in
"cntr_value" is very high and increases slowly (5-10 /minute).

但更新率非常低。一分钟左右。它也说“Transactions / sec”,但“cntr_value”中的值非常高并且缓慢增加(5-10 /分钟)。

object_name > SQLServer:Databases   
counter_name > Transactions/sec  
instance_name > DB_NAME   
cntr_value > 4258268   
cntr_type > 272696576

What am I missing?

我错过了什么?

1 个解决方案

#1


0  

As per the documentation, you have to take the cntr_type into account in order to interpret the value properly. In this case, it is an accumulating counter. That is, it's incrementing with each transaction. So, to get transactions/sec, you need to take two observations at different times and take a quotient of the difference in observations and the difference in the times. For example, if I observed a value of 10 at T-minus zero and 20 at T-plus five seconds, I'd calculate an average transactions/sec (TPS) of (20-10)/(5-0) = 10/5 = 2 TPS.

根据文档,您必须考虑cntr_type才能正确解释该值。在这种情况下,它是一个累积计数器。也就是说,它随着每笔交易而递增。因此,要获得事务/秒,您需要在不同时间进行两次观察,并根据观察结果的差异和时间的差异得出商数。例如,如果我在T-minus零处观察到10的值,在T-plus 5秒处观察到20的值,我将计算平均事务数/秒(TPS)为(20-10)/(5-0)= 10 / 5 = 2 TPS。

#1


0  

As per the documentation, you have to take the cntr_type into account in order to interpret the value properly. In this case, it is an accumulating counter. That is, it's incrementing with each transaction. So, to get transactions/sec, you need to take two observations at different times and take a quotient of the difference in observations and the difference in the times. For example, if I observed a value of 10 at T-minus zero and 20 at T-plus five seconds, I'd calculate an average transactions/sec (TPS) of (20-10)/(5-0) = 10/5 = 2 TPS.

根据文档,您必须考虑cntr_type才能正确解释该值。在这种情况下,它是一个累积计数器。也就是说,它随着每笔交易而递增。因此,要获得事务/秒,您需要在不同时间进行两次观察,并根据观察结果的差异和时间的差异得出商数。例如,如果我在T-minus零处观察到10的值,在T-plus 5秒处观察到20的值,我将计算平均事务数/秒(TPS)为(20-10)/(5-0)= 10 / 5 = 2 TPS。