Why is a VB Project Running 3x Slower on Windows Server 2019 Compared to Windows Server 2008 R2?

Rob Birney 21 Reputation points
2025-06-05T15:02:55.19+00:00

I have a 64bit project, created using VS2022 and VB, which used to run on a Windows 2008 R2 server accessing a database on a different server.

The project is now moving to run on a Windows 2019 Standard server, accessing that same database on the different server.

The problem is that the project is now running very slowly on the Windows 2019 Standard server.

The communication and data transmission speeds between the servers have been checked (See note at end of Question).

When I run the project on my test machine, but using a copy of the live database, the times taken are acceptable.

When I run the compiled project on the Windows 2019 system, the time taken is much longer (3x as long as it takes on the Windows 2008 R2 system).

When I use the Performance Profiler on my Windows 11 test machine and log into the system, load a Form which populates two combo boxes, and exit from the Form and the system I get, amongst others, the following information for the subroutine that reads the data in and populates the combo boxes:-

																Usage
```System.Windows.Forms.Combobox.ObjectCollection.Add(System.Object)	5.36%	58926

System.Data.odbc.odbcDataReader.get_Item(string)					0.39%	54774

System.Data.odbc.odbcDataReader.Read()							0.07%	27388

System.Windows.Forms.ComboBox.get_Items()						0.02%	58932

MyProject.MyForm.get_cboOrderNo()								0.01%	27398

MyProject.MyForm.get_cboHiddenPId()								0.01%	27396

The portion of the subroutine that reads in the code is as follows:-

```vba
            While reader.Read

                cboOrderNo.Items.Add(reader("orderno"))

                cboHiddenPId.Items.Add(reader("p_id"))

            End While
```I have inserted some basic timing into the subroutine and I have found that:-

If I comment out the statement loading the data into the cboOrderNo and run the compiled project on the live system, but leaving the statement loading the data into the cboHiddenPId, the time taken is still acceptable.

If I comment out the statement loading the data into the cboHiddenPId and run the compiled project on the live system, but leaving the statement loading the data into the cboOrderNo, then the time taken is approximately 3x as long as getting to the same point on the Windows 2008 R2 system.

The OrderNo is a varchar(6) field and the HiddenPId field is an integer.

Can anyone suggest a reason why this might be?
The database has now been moved to the same Windows Server 2019 as the project but it runs just as slowly.

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,889 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.