SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Link copied. Please paste this link to share this article on your social media post.
Hi, I am using the ewsItemManager out of the Utilities library and wondering where is the best place to instantiate this in a long running processor. Currently i have it in my DoUpdates loop where it is being created each time the processor goes through the incoming data and updates the changed values on the EWS server, but I am seeing some degradation of performance over time and wondering if that could be the cause?
Link copied. Please paste this link to share this article on your social media post.
Hello,
It depends a bit on how you're using it and what kind of performance degradation you but most things in Smartconnector are designed around short lived processors.
You could try
ewsItemManager.DataAdapter.CreateDatabaseContext();
to refresh the datacontext of the DataAdapter where it's applicable in your loop.
BR
Armend
Link copied. Please paste this link to share this article on your social media post.
Hello,
It depends a bit on how you're using it and what kind of performance degradation you but most things in Smartconnector are designed around short lived processors.
You could try
ewsItemManager.DataAdapter.CreateDatabaseContext();
to refresh the datacontext of the DataAdapter where it's applicable in your loop.
BR
Armend
Link copied. Please paste this link to share this article on your social media post.
Hi Armend,
I am creating an instance of the ewsItemManager in the DoUpdates() method which is periodically called by the long running processor. I am using it to read current ews values and write to them if they need to be updated.
When started, the processor takes about 6 seconds to do all the updates. The DoUpdates() method repeats 10 seonds after if finishes, until the cancellation token is called.
After about 4 hours, the time to update the values goes from 6 seconds to about a minute, and keeps getting longer. As soon as you restart the processor, it goes back to 6 seconds.
If i replace all the instances of ewsItemManager with DataAdaptor, the update time is less than 2 seconds and doesn't increase. I understand the ewsItemManager may have some additional overhead, but I don't understand why it would get slower over time. The only thing i can put it down to is that i am creating a new instance of it, each time i DoUpdates() and something is not getting cleaned up. I tried to do ewsItemManager.Dispose() at the end of each update, but it actually disposes of the dbContext and stops the processor. My SmartConnector is working fine now using the DataAdaptor directly, but curious to know what is happening here, or if i am doing something wrong.
Link copied. Please paste this link to share this article on your social media post.
Without seeing your code it's impossible to say for sure, but probably your datacontext(entity framework) is getting huge when using the EwsItemManager. When using the DataAdapter you're probably (knowingly or inadvertently) refreshing the context. There should not be any overhead when using the EwsItemManger.
I suggest you try adding the line I suggested above, or preferably refactoring your processor to run when needed. If you are using a long running processor because you have state in the processor you can use the Cache to save state between runs.
BR
Armend
Link copied. Please paste this link to share this article on your social media post.
Hi Armend,
This seemed to work:
ewsItemManager.DataAdapter.CreateDatabaseContext();
Thanks for your help.
Steve
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.