AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题 / 183941
Accepted
Sir Swears-a-lot
Sir Swears-a-lot
Asked: 2017-08-21 14:09:20 +0800 CST2017-08-21 14:09:20 +0800 CST 2017-08-21 14:09:20 +0800 CST

SSRS:第一份报告很慢:重新加载 Appdomain

  • 772

我的任务是每天改进第一个报表连接的性能。类似于这个帖子。

我们有一个简单的 SSRS 报告作为登录页面。它具有指向后续报告的超链接。

我努力了:

  • 在早上 6:30执行powershell 重启脚本。
  • 将报告缓存配置为在重新启动后每 10 分钟按计划刷新一次
  • 添加订阅。
  • 安排一个powershell 脚本来导出报告。

似乎问题在于 SSRS 以某种方式对待这些连接的方式与真实用户通过 Web 浏览器打开报告的方式不同。即使报表已运行,它的处理方式似乎也与用户通过门户点击它的方式不同。所以......第一个用户遇到了很大的延迟。

使用 Internet Explorer 中的 F12 调试功能,我设法重现并捕获了浏览器所看到的内容。SSRS 只用了 4 秒来生成和返回报告,但是在浏览器中从尝试打开 URL 到正在呈现的屏幕需要 122 秒。2分钟!!!难怪用户抱怨。

查看我的 SSRS 日志文件(位于:C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\LogFiles),SSRS appdomain 似乎正在重新启动或重新加载。

下面的日志摘录显示

  1. 计划在 08:00:19 和 08:10:19 刷新缓存
  2. 随后是我的报告请求,大约 8:15:01
  3. 我直到大约 8:17:06 才收到报告

日志文件:

library!WindowsService_0!1bdf8!08/24/2017-08:10:19:: i INFO: Call to CleanBatch()
library!WindowsService_0!1bdf8!08/24/2017-08:10:20:: i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, etc etc 
library!WindowsService_0!1bdf8!08/24/2017-08:10:20:: i INFO: Call to CleanBatch() ends
appdomainmanager!DefaultDomain!adb0!08/24/2017-08:15:01:: i INFO: Registering AppDomain: type='ReportServer'; id='3'; Name='ReportServer_MSSQLSERVER_0-1-131479929006508632'
appdomainmanager!DefaultDomain!adb0!08/24/2017-08:15:01:: i INFO: Creating a new AppDomainLifeCycleManagementEntry for AppDomain id '3'
appdomainmanager!DefaultDomain!adb0!08/24/2017-08:15:01:: i INFO: Appdomain STARTED: id='3'; name='ReportServer_MSSQLSERVER_0-1-131479929006508632'
appdomainmanager!ReportServer_0-1!adb0!08/24/2017-08:15:08:: i INFO: RS authentication mode is 4; effective ASP.NET authentication mode is Windows. vdir=/ReportServer.
appdomainmanager!DefaultDomain!adb0!08/24/2017-08:15:08:: i INFO: Appdomain:3 ReportServer_MSSQLSERVER_0-1-131479929006508632 initialized (#1).
appdomainmanager!DefaultDomain!adb0!08/24/2017-08:15:08:: i INFO: SetInitialized AppDomain id '3': initialized = 1
webserver!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: Reporting Web Server started
library!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: SQLDump flags: ReferencedMemory, AllThreads, SendToWatson
library!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: MiniDump flags: DataSegs, UnloadedModules, ProcessThreadData
library!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: Dump on: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogExceptionMicrosoft.ReportingServices.
library!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: Do not dump on: System.Threading.ThreadAbortExceptionSystem.Web.UI.ViewStateExceptionSystem.OutOfMemoryExceptionSystem.
library!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: Minidump location: C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\Logfiles
runningjobs!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: Running Requests Scavenger timer enabled: Next Event: 60 seconds.  Cycle: 60 seconds
runningjobs!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: Running Requests DB timer enabled: Next Event: 60 seconds.  Cycle: 60 seconds
resourceutilities!ReportServer_0-1!adb0!08/24/2017-08:16:51:: i INFO: Reporting Services starting SKU: Developer
ui!ReportServer_0-1!adb0!08/24/2017-08:16:52:: i INFO: Installed SKU: Developer edition
ui!ReportServer_0-1!adb0!08/24/2017-08:16:52:: i INFO: Registering with Software Usage Metrics Product:SQL Server 2016, Role:Microsoft SQL Server Reporting Services,  etc etc
library!ReportServer_0-1!adb0!08/24/2017-08:16:52:: i INFO: Call to GetItemTypeAction(/CIA). User: MYDOMAIN\prm.
library!ReportServer_0-1!adb0!08/24/2017-08:16:53:: i INFO: Catalog SQL Server Edition = Developer
crypto!ReportServer_0-1!adb0!08/24/2017-08:16:54:: i INFO: Initializing crypto as user: NT Service\ReportServer
crypto!ReportServer_0-1!adb0!08/24/2017-08:16:54:: i INFO: Exporting public key
crypto!ReportServer_0-1!adb0!08/24/2017-08:16:54:: i INFO: Importing existing encryption key
library!ReportServer_0-1!adb0!08/24/2017-08:17:02:: i INFO: Entering StreamRequestHandler.ExecuteCommand - Command = StyleSheet
library!ReportServer_0-1!adb0!08/24/2017-08:17:02:: i INFO: Exiting StreamRequestHandler.ExecuteCommand - Command = StyleSheet (success)
library!ReportServer_0-1!adb0!08/24/2017-08:17:06:: i INFO: Call to GetItemTypeAction(/CIA). User: MYDOMAIN\prm.
library!ReportServer_0-1!adb0!08/24/2017-08:17:06:: i INFO: RenderForNewSession('/CIA')
library!ReportServer_0-1!adb0!08/24/2017-08:17:07:: i INFO: Using folder C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\blahblahblah

由于到目前为止我尝试过的各种解决方法似乎都不起作用......
在真正的用户尝试运行报告之前,如何强制 SSRS 执行此操作?

sql-server sql-server-2016
  • 2 2 个回答
  • 2149 Views

2 个回答

  • Voted
  1. Best Answer
    Jerb
    2017-09-13T00:57:09+08:002017-09-13T00:57:09+08:00

    我想我已经能够解决我认为大致相同的问题。

    早上的第一件事是,如果我访问我们的报表服务器 URL,它的加载速度足够快,我可以立即浏览菜单,没有任何问题。但是只要我点击一个实际的报告,在报告实际执行之前有 2 分钟的等待......

    【快速测试……我这次只有75秒,但感觉更长了!】

    使用“RS”命令从命令行运行报告似乎会启动(唤醒!)无论架构的任何部分都没有启动,并且第一个报告需要正常的时间来执行。我将把它作为一项任务来处理并忘记它。

    RS 使用起来有点繁琐,因为您需要编写一些 VBA 脚本来执行报告,但我已经需要为我的另一份工作解决这个问题..

    编辑:在下面添加脚本

    我不能真的把所有的功劳都归功于这一点,也不能引用我害怕的参考资料。它由已经存在的 3 或 4 个不同资源拼凑而成,并根据我的需要进行了调整(具体来说,我想为一系列输入生成一组 pdf 导出)。然后在这里简化一点:

    脚本文件“RunReport.rss”

    Public Sub Main()
    
      Dim format as string = "PDF"
      Dim fileName as String
      ' adapt the following variable for your report location
      Dim reportPath as String = "/{my file path}/{my report name}"
    
      Dim parameters(0) As ParameterValue
    
      ' Prepare Render arguments
      Dim historyID as string = Nothing
      Dim deviceInfo as string = Nothing
      Dim extension as string = Nothing
      Dim encoding as string
      Dim mimeType as string
      Dim warnings() AS Warning = Nothing
      Dim streamIDs() as string = Nothing
      Dim results() as Byte
    
    
      rs.LoadReport(reportPath, historyID)
    
      fileName = "output.pdf"
    
      results = rs.Render(format,  deviceInfo, extension, _
      mimeType, encoding,  warnings, streamIDs)
    
      ' Open a file stream and write out the report
      Dim stream  As FileStream = File.OpenWrite(fileName)
      stream.Write(results, 0, results.Length)
      stream.Close()
    
    End Sub
    

    然后从命令行执行

    rs -i RunReport.rss -s http://{my server name}/reportserver -t -e Exec2005
    

    在这种情况下,会创建一个名为“output.pdf”的文件

    希望这可能有用吗?

    • 3
  2. Sir Swears-a-lot
    2017-09-11T13:04:07+08:002017-09-11T13:04:07+08:00

    我找到了一种解决方法,但不是我特别满意的一种。我们设法使用我们的网站监控软件来访问 SSRS 报告服务器,并且它似乎足以启动 SSRS Web 组件。当天的第一个用户现在可以在 4 秒内得到响应。

    我花了几个小时试图让 powershell 为我做这件事,并且非常接近。所以我会把它留在这里。如果其他人可以解决最后一块难题并完成这项工作,我将把答案归功于他们:

    $username = "<Domain\user>"
    $password = "<Password>" | ConvertTo-SecureString -asPlainText -Force
    $cred = New-Object System.Management.Automation.PSCredential($username,$password)
    $response = Invoke-WebRequest -Uri "http://<ServerName>/ReportServer/Pages/ReportViewer.aspx?%2f<ReportName>" -Credential $cred
    $stream = [System.IO.StreamWriter] "D:\temp\Out.html"
    try {$stream.Write($response.Content)} 
    finally {$stream.Dispose()}
    

    缺少的关键部分是 SSRS 使用 Web 门户进行响应。

    • 1

相关问题

  • SQL Server - 使用聚集索引时如何存储数据页

  • 我需要为每种类型的查询使用单独的索引,还是一个多列索引可以工作?

  • 什么时候应该使用唯一约束而不是唯一索引?

  • 死锁的主要原因是什么,可以预防吗?

  • 如何确定是否需要或需要索引

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve