Hey everyone,
I’m currently building a dashboard to help my ~20 server admin colleagues with their daily doings. I’m kinda getting more and more the hang of it but there is one major issue I cannot fix: performance.
My current design looks like this:
App with ~20 separate pages.
One of those is a simple homepage with a grid layout of cards that link to those other subpages.
All but one of those subpages are simple form pages with tabs. No data gathering, nothing.
The last one is a data grid that displays information about past jobs and active schedules, also divided by tabs.
My usual page logic is as follows:
Card → scriptblock to create a form, sometimes individual fields based on inputs in other fields of the form → OnSubmit sends the body to a dedicated function that validates parameter input based on a json of valid inputs and returns a scriptblock when inputs are ok → scriptblock that uses Invoke-PSUScript with the relevant parameters.
The data grid page pulls all jobs once when the page is accessed, no autorefresh or anything, but there is a refresh button that syncs the dynamic table area. Doesn’t really matter how many jobs it has to pull, the issue is persistent between all my environments, see below for details.
Environments look as follows:
Prod: PSU clustered between two servers, each with 4 CPUs and 8 GB RAM
Dev: same, but only one host
All development is done via a personal dev environment, anyway, all performance metrics seem to be fine, none of the machines is even close to RAM or processing limits.
Currently still using PSUv4, migration to v5 is planned in the coming weeks.
How the issue presents itself:
Its often the case that when you access a page that it takes quite a long time to load a form for example. You see the skeleton of the form and sometimes after 1 minute the form loads. It is possible to accelerate this by refreshing manually and sometimes it works and sometimes it doesn’t. In some cases I get error modals that something like Get-PSUScript is not recognized as a known function. Happens with other PSU internal functions as well. This is the main issue as it really hinders usage. My colleagues don’t like to use the tool because of this.
When I’m developing and saving my changes in VSC (with the PowerShell Universal extension), the page with a form for example refreshes but I cannot submit the form. The submit button just doesn’t work. Even a refresh of the page doesn’t fix it so my way of testing changes requires me to go to some other page and navigate back to the page I changed and then it works ONCE. It’s kind of annoying.
I recently moved all scriptblocks into functions in a module, so that the page content in PSU looks like this:
Import-Module
New-Home_Page
This way I can edit the pages easier because VSC doesn’t mess up the code formatting of the page.
I also tried setting pages to static and tabs to only render when active.
It feels like there is something fundamentaly wrong with the way I built it but I cannot figure out what or why. Could you please help me?
Kind regards,
Sebastian