UD on IIS application: howto speed up initial load and do background refresh of data?

Hi,

We have installed the module Universal Dashboard on IIS following the instructions here Page Navigation in IIS

1.installed prereqs
2.since we are using IIS for hosting other sites,created an application in IIS, TestApplication\UniversalDashboard
3.copied community (will buy licensed one soon and will activate authentication) to this location
c:\windows\web\TestApplication\UniversalDashboard
4.changed to web.config (removed security part for now, otherwise it wouldn’t load), then changed the index.html with the path to this \TestApplication\UniversalDashboard
5.made a dashboard.ps1

Running http://iisserver/TestApplication/UniversalDashboard
works fine but takes quite some time to load.

Our questions:
1.how can we increase the speed of loading first time + next times?
2.the dashboard.ps1 is showing data which needs to be refreshed at regular times,
how do we make sure this data is refreshed in the background, so webpage shows data right away (+ last refresh time)?

Thanks for your input.
Steven

hi @stevenbaert,

q1:
the really first time will allways be slow. IIS has to load the dashbaord sever exe. after that loading times are very fast. you can also configure IIS to keep the app pool running and do not recycle if no one access that site.

q2: you need scheduled endpoints to load fresh data in the background:
https://docs.universaldashboard.io/endpoints/scheduled-endpoints

Thanks!
The refresh works for a simple get-service test page (on IIS) but not for our fetch of data.
The data is there but refresh does not happen.

Here is the code, input where to debug is much appreciated.

`$Date = get-date
$Schedule = New-UDEndpointSchedule -Every 2 -Minute
$Every2Minutes = New-UDEndpoint -Schedule $Schedule -Endpoint {$NewRequestData}

$Dashboard = New-UDDashboard -Title “OurDashboard refreshed at $day” -Content { $cache:newRequestData = @()#then the fetch of the data

 New-UDRow -Columns {
      New-UDColumn -Size 12 -Content {
           New-UDGrid -Title "New itemss" -Headers @("Vendor","Application Name","Version") -Properties @("Vendor","Name","Version") -Endpoint {
                $cache:newRequestData | Select-Object Vendor,Name,Version | Out-UDGridData
           } -FontColor "black" -DefaultSortColumn "Intake Date" -DefaultSortDescending
      }

}

Start-UDDashboard -Dashboard $Dashboard -Wait -Endpoint @($Every2Minutes) -AutoReload`

New-UDDashboard -Title “OurDashboard refreshed at $day”
The Dashboard title is not refreshable, it will be generated at the dashbaord startup once.

Here is a working example: have a look at where the cache variable is set and used:

$Schedule = New-UDEndpointSchedule -Every 1 -Minute

$Every2Minutes = New-UDEndpoint -Schedule $Schedule -Endpoint {
    $cache:Date = Get-Date -Format "HH:mm:ss"
    $cache:newRequestData = Get-Process | sort cpu -Descending| select Name,cpu,ws
}

$Dashboard = New-UDDashboard -Title "OurDashboard" -Content { 
    New-UDRow -Endpoint {
        New-UDHeading -Text "data refreshed at $cache:Date"
    } -AutoRefresh
    New-UDGrid -Title "New items" -Headers @("Name","CPU","WS") -Properties @("Name","CPU","WS") -Endpoint {
        $cache:newRequestData | Out-UDGridData
    } -FontColor "black" -DefaultSortColumn "Intake Date" -DefaultSortDescending -AutoRefresh

}

Start-UDDashboard -Dashboard $Dashboard -Endpoint @($Every2Minutes) -AutoReload -Wait

2.4 is going to support page titles (already merge to master :smile:) It will change the title of the browser tab as well as the header text.

        $Page1 = New-UDPage -Name "Home" -Content {
            New-UDCard -Text "Home"
        } -Title "My First Page"

        $Page2 = New-UDPage -Url "/mypage" -Endpoint {
            New-UDCard -Text (Get-Date) -Id "page-with-spaces"
        }  

        $dashboard = New-UDDashboard -Title "Test" -Pages @($Page1, $Page2)

Thanks, works great!
However, debugging is pretty difficult in this setup.
Isn’t there a way to seperate the PoweshellScript which generates the output with the Universal Dashboard output?
That’s the way I was running my reports before: scheduled task which runs a PowershellScript for data collection another script to output into index.html an publishes this html to an IIS site.

Btw, would love to have a way in which I can generate the data, f.e. $Output then relaunch the Universal Dashboard and refresh the webpage versus now = run Universal Dashboard via the dashboard.ps1, recycle the application pool, load the webpage and wait for it to load (takes quite some time :-().