scott-vincent / instrument-panel

An instrument panel for Microsoft Flight Simulator 2020
171 stars 29 forks source link

Significant lag when running multiple instances of "instrument-panel.exe" #34

Closed TDX00 closed 2 years ago

TDX00 commented 3 years ago

I've found that the instrument panel works perfectly running on a second Win10 PC - very smooth and responsive. However, I've observed that the panel becomes very laggy if two or more instances of the instrument panel are running at once. This occurs both when two instrument panels are running on the same PC, or two separate PCs.

My use case is that I have two Intel NUCs connected to four 10" LED displays. I've customised the json to split the available instrument gauges across all four displays, with one instance of "instrument-panel.exe" running on each NUC. One NUC will run perfectly until I start the app on the second, then it's lag city. The two NUCs and my Sim PC have wired ethernet connection to the same network switch.

The Wiki currently says "You can run as many instrument panels as you like. They all connect to the same data-link." Is there possibly an issue with the data link application handling multiple instances of instrument-panel.exe? I kinda doubt this is relevant, though the CMD interface for the data link app will show "Instrument panel connected from <IP of NUC 1>" when connected, though there's no feedback when a second instance of "instrument-panel.exe" connects to the same data link.

Thanks Scott for creating such an excellent tool and making it available to the Flight Sim community for free. You're a steely-eyed missile man!

scott-vincent commented 3 years ago

The 'client' controls the update rate and data-link responds to each request. I have 4 clients that all connect to my data-link but they are customised clients, i.e. I have one instrument panel, one radio panel, one autopilot panel and one power/lights panel. Instrument panel uses quite a high update rate so if running multiple of these I would suggest you reduce the rate from 30 times per second to say 10 times per second. If you look at simvars.cpp from line 794 you will see this is where it is set. Change Sleep(33) to Sleep(100) and change usleep(33333) to usleep(100000). You should then be able to run 3 or 4 instrument panels with no lag.

scott-vincent commented 3 years ago

BTW, I need to make the update rate a value in the settings file. Will add this to my list of things to do. Ideally, you would have to customise the code so it just sends the data that a client is interested in, then the rate could be higher. This is what I do for my radio, autopilot panels etc. Also, the data-link should be muti-threaded when dealing with client requests but unfortunately it isn't at the moment.

TDX00 commented 3 years ago

Great response, thank you! I don't know where to start when it comes to Linux and compiling software, so I'm happy to wait until the data rate can be modified within the settings JSON file. For now I have everything squeezed into two (combined) 10" displays so I only need to run one instance of the client. Cheers again.

scott-vincent commented 2 years ago

Done