Skip to main content
1-Visitor
January 21, 2019
Question

performance issues with an sql query service that executes a stored procedure in MS SQL

  • January 21, 2019
  • 9 replies
  • 4888 views

I have a stored procedure defined in an MS SQL database,  I have an sql query service defined in a thing template as follows:

 

SET NOCOUNT ON
EXEC [dbo].[sp_Local_GetWorkOrdersOperationStep_ByWO]
@WorkOrder = [[WorkOrder]]

 

where workorder is a test string

 

under previous versions of Thingworx (up to version 7.3) we had no issue (the service would run in about the same time it would take to run in server management studio -> between 5 and 15 seconds).  We upgraded to 8.1 within the last 6 months and now I observe that this query generally takes anywhere from 45 seconds to several minutes.  I have tried just about every ms sql jdbc driver available including (the latest preview release:   mssql-jdbc-7.1.4.jre8-preview) and nothing has changed.  I recently created a servlet to execute this stored procedure from and installed in on the same server.  The servlet executes this stored procedure in 5 to 15 seconds (same as server management studio) which tells me the problem in occurring within Thingworx.    I have this same code installed on about 7 different machines with each machine talking to the same database including my own laptop.   Every one show this same poor performance with one exception:  on my laptop I was able to define this sql query service directly in the thing (which is used to execute it) and it will execute in the same amount of time it takes in server management studio (or no other machine was this same behavior observed).  I am not sure how to diagnose what is causing the poor performance so any insight would be greatly appreciated 

9 replies

5-Regular Member
January 23, 2019

Hello,

 

I see that you have the same query on all instances but the one that runs within the normal Timeframe is on your laptop. Is the instance on your laptop also the same version as the others or are you still running a version earlier than 7.3?

 

One one of the instances with slow performance, can you open the developer tools to the "Network" tab in the browser and then test the stored procedure? Then click on the waterfall information to display the breakdown of where time was spent executing the process? Please take a screen shot of this information as shown in the image below.

Test-database_query.png

 

kyetzer1-VisitorAuthor
1-Visitor
January 24, 2019

The result is attached

 

 

Almost all the time is spent waiting for the first byte of data.

kyetzer1-VisitorAuthor
1-Visitor
January 24, 2019

Every single instance is using version 8.1