Question Windows Service Deployment - Performance Difference

Aia

Member
Joined
Oct 9, 2007
Messages
21
Location
Canada
Programming Experience
Beginner
Hello,
I have a windows service that accepts socket connections, receives tcp/ip packets from the open connection and then buffers the packets in an object. Another thread comes along and removes the packets one at a time and decodes the packets and then stores them into a database.

I have two different computer systems.
The developmental machine is running a single 2.4GHZ core with 1 gig of ram and a 30 gig hard drive.
The production machine is a dual core 2.4GHZ with a gig of ram and a 250 gig hard drive.
Neither system uses anywhere close to half its processing power during the test.

The service publishes without a problem and I can use the installutil on either machine to have it install correctly. The service also does all the work that is should do. However the problem is the fact that the less powerful developmental machine is able to handle 320 connections, each connection sends 4 packets and process them in about a minute. The same task takes the production computer almost 5 minutes to accomplish the same task. Both machines used the same published file for the test.

I have tried to pay careful attention to the software being used on both machines. The following is the software I know is the same.
Microsoft recent system patches for XP Professional (service pack 3)
MYSQL 5.0.51b
WardaemonFTP 1.8
MYSQL Connector/net 5.0.9
Apache

I am at a lose for what could be causing such a difference in performance.
 
Hello,
I started disabling different parts of the service to see if I could track down which of the 5 possible parts was causing the performance difference (4 packet decodin, 1 database insertion). It was the database insertion that was causing it to have poorer performance. This leads me to two possible problems. Either there is something wrong with my code, or there is something different with the software on the production machine. I have included the sub and related information just in case.

VB.NET:
Imports MySql.Data.MySqlClient 'uses mysql connector/net 5.0.9.0

dim connection as string = "server=localhost;port=<>;user id=<>;password=<>;database="
'the port,id, and password were removed, database is mysql, and yes I am not using the default port.

 Public Sub Insert(ByVal insert As String, ByVal id As String)
        Dim conn As New MySqlConnection
        conn = New MySqlConnection()
        Dim myCommand As New MySqlCommand
        Dim database As String = ""
        If (id = main_database) Then
            database = main_database
        Else
            database = compid(id)
        End If
        conn.ConnectionString = connection & database
        Try
            conn.Open()
            myCommand.Connection = conn
            myCommand.CommandText = insert
            myCommand.ExecuteNonQuery()
            conn.Close()
        Catch ex As Exception
            Service1.errors("Insert Error: " & ex.Message, file)
        End Try
        conn.Close()
        conn.Dispose()
    End Sub
 
Last edited by a moderator:
Update: compid() function
The compid function is one I programmed to return which database a unit belonged to. The information was located in objects that are created on startup and then checked every few minutes to make sure that they are upto date.
I decided that I should test the function to see if it was causing the delay. I replaced the call with a hardcoded string of where the units would be ending up in. There was no effect.
Also, no errors are thrown at any time.
 
Hello,
I was running another series of tests, this time to see if using the non-standard port would impact on performance. All the tests used the same published file. The test consists of 320 connections being made within 1 minute; each connection contains 4 packets that are buffered. The developmental machine completes the test in 1 minute. In all tests the program making the connections is on the developmental machine.

First, this test was run 3 days ago on Friday, July 18. No changes had been made. The result was 4-5 minutes.

Second, I changed the router so that port 3306 was now sent to the production machine and not the developmental. This is the reason why it was not using the standard port. I changed the start-up options so that it now used 3306. I started the service only to have it end unexpectedly. I had forgotten to reconfigure the mysql installation so that it was using 3306. I reconfigured the installation and attempted to make no other changes. Started the service and the test was completed in 2 minutes.

Third, I changed the port back to the non-standard one I have been using. I then reconfigured the mysql installation for that port, again trying to avoid making any other changes to the installation. I changed the router and start-up. This test completed in 2 minutes.

The fourth test was run on the developmental machine to confirm that the results for it were 1 minute. The test was successful.

In all tests the task manager does not show system usage over 5%.

The following is the mysql configuration I used:
Detailed
Server Machine
Multifunctional Database
Default setting for InnoDB
Online Transaction Processing (OLTP)
TCP/IP networking was enabled, ports were 3306 or 50000. Strict mode yes.
Standard Character Set
Installed as windows service, bin directory not included in windows path
root access allowed from remote machines. No anonymous accounts.
 
Update:
I did miss something from the configuration change. The replication was lost. Once I restored replication between the two machines performance dropped just like the tests from last week. Replication is not done behind the router, both machines are configured to access each other from outside the router (the need for the non-standard port).
The lines I entered into the my.ini to set up the replication are
server-id=1
log-bin=mysql-bin
sync_binlog=1
These same lines are in the my.ini file for the developmental server. But there is no performance problem there. Except that the server-id is 5618.
 
Back
Top