IIS日志中95%的平均百分比

时间:2011-11-09 20:01:39

标签: sql performance iis

我已经为生产推动做好了准备,而且不幸的是,以前的系统没有记录性能统计数据。

我有IIS日志,并且能够计算吞吐量和平均/最高要求。

有没有办法计算95%的时间平均和最大要求,以便数字不包括最大值?我对频谱的完整范围不感兴趣,我只想放弃一些最大时间,看看当前系统吞吐量的近似值。

我当前的查询是

SELECT
    DatePart(Year,date_time),
    DatePart(Month,date_time),
    DatePart(Day,date_time),
    DatePart(hh,date_time),
    count(*) as [Req/h],
    COUNT(*)/3600 as [Req/s],
    COUNT(*)/60 as [Req/m],
    sum([time-taken]) / count(*) as AverageServerTime,
    Max([time-taken]) as MaxServerTime
  FROM [iis_logs].[dbo].[events]
  where 
  uri_stem like 'stemprefix/%' and 
  host ='www.domain.com'
   and date_time > '11/8/2011'
   and date_time < '11/9/2011'
  group by  
    DatePart(Year,date_time),
    DatePart(Month,date_time),
    DatePart(Day,date_time),
    DatePart(hh,date_time)

1 个答案:

答案 0 :(得分:0)

这似乎正在寻找我正在寻找的东西(它不会根据小时报告,但这对我的目的来说足够好。)

Select 
    sum(t.time) / count(*) as AverageServerTime,
    Max(t.time) as MaxServerTime
    From
    (
SELECT Top 95 percent
    [time-taken] as time
  FROM [iis_logs].[dbo].[events]
  where 
  uri_stem like 'prefix%' and 
  host ='www.domain.com'
   and date_time > '11/8/2011'
   and date_time < '11/9/2011'
  order by [time-taken]
) t