09-26-2011 04:31 AM
Dear All,
My Setup:
Fetching data from database in every 1 sec.
the code executes in msecs, but after 1-2 hrs the code execution time increases also the CPU goes to 50% consumption.
Now when i debug the code with probe, then it shows that sometime opening connection takes time, sometime execution of query, sometimes closing the database connection (time is calculated through the last update time),
Have somebody got this kind of situation.
Regards,
Shrek
09-26-2011
04:56 AM
- last edited on
03-26-2025
08:38 AM
by
Content Cleaner
Hi Shrek,
I'm Jamie an Applications Engineer at NI UK.
As your code initially runs smoothly then slows down over time it may be worth tracing the executions steps using the "NI LabVIEW Execution Trace Toolkit." This toolkit should enable identification of problems that could negatively impact performace including reference leaks, memory allocation, unhandled errors, and subVI execution.
Kind Regards
Jamie
09-26-2011 06:06 AM
Are you opening and closing the connection every second? If so, my guess would be that you are suffering from TCP port exhaustion.
Port exhaustion is more of a code design issue than a LabVIEW one. Rather than open and close every second, open the DB and use a shift register in a while loop to perform your query every second against the existing session. If you must open and close every time, there are 2 ways to handle the issue (increasing the number of allowed ports and reducing the delay before they are closed and recycled).
In our implimentation, we chose to do both. We decreased the TCPTimedWaitDelay value from 240 seconds to 30 and increased the MaxUserPort setting from 5000 to 10000.
For details, see this MSDN article:
http://msdn.microsoft.com/en-us/library/aa560610(v=bts.20).aspx
09-27-2011 04:11 AM
Dear Jamie,
I have tried with Desktop Execution Trace toolkit but there is no reference leaks ans very less memory resize and i also have debugged it, no errors are there.
but i have observed one more thing, when the delay in execution starts, the delay continues to come until i restart labview.
so can we say that something is stored in the memory(buffer) and gets full after sometime and when i close labview then the buffer is initialised with null value.
Regards,
Shrek
09-27-2011 04:17 AM
Thank you Philip,
I have tried what is written in the microsoft link about active ports, but the no. of active ports are only 16.
am i missing anything
09-27-2011 04:46 AM
Hi Shrek,
It does seem that a "buffer" or area of memory is being filled resulting in the program lagging. Would it be possible to provide a code snippet or vi upload to provide a better idea on how your solution is implemented?
Thanks
Jamie
09-27-2011 09:55 AM
Can you tell us what database you are connecting to (Oracle, MySQL, Microsoft,...) and the connection type (ODBC, native,...)
Also, what version of LabVIEW and DB interface are you using (LabVIEW Database Connectivity Toolkit, LabSQL, SQLite
There are some combinations that leak memory (some in LabVIEW and some in the underlying driver)
09-27-2011 10:08 AM
09-29-2011 01:23 AM
LV 2009
Microsoft SQL Server R2
ODBC Connection
LabVIEW Database Connectivity Toolkit,
10-03-2011 06:59 AM - edited 10-03-2011 07:00 AM
I couldn't find any known issues for your specific combination on the NI forums.
One thing that did sound similar is this thread:
The situation seems to have been the same, repeated queries after many hours resulting in memory consumption. I would guess that this is related to the recordset object somehow not being disposed of correctly. One poster commented that his memory leak disappeared when he switched to a different LabVIEW database library (ADO Toolkit for LabVIEW).
I'm only sharing what I found. I can't comment on the library (never used it) or the accuracy; just a piece of data to help you in tracking down your problem.