mrai

AF Element creation via C#.NET very slow

Discussion created by mrai on Feb 9, 2010
Latest reply on Feb 11, 2010 by mrai

Any help will be greatly appreciated!!!!

 

Difficulties in automating the AF Element creation process using PI SDK and AF SDK

 

I am developing a C#.NET AF element creation tool. It queries the PI server using PISDK GetPointsSQL() method and loops thro the PointList and creates corresponding AF elements in AF Server. The application was performing ok when we had a few thousand tags, however once we loaded all our tags, the application crashes with the following error:

 

"The CLR has been unable to transition from COM context 0x1095f38 to COM context 0x10960a8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."

 

Questions:

 

1. Do I need to introduce some wait times during each element creation ? Will this solve the problem ?

 

2. I also thought of doing this job in smaller chunks (like do 5000 tags everytime) which also seems to be very slow. ? What is the most efficient way to do this ?

 

3. Does OSIsoft provide any tool to automatically create AF elements given the PI server location ?

 

Thanks in advance for your help:

 

 

Outcomes