Print Page | Close Window

EntityManager in a WCF Service

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2710
Printed Date: 13-Apr-2026 at 6:43pm


Topic: EntityManager in a WCF Service
Posted By: downeytim
Subject: EntityManager in a WCF Service
Date Posted: 24-May-2011 at 12:30pm
Does anyone have WCF services built using DevForce for data access?  We have several services built and have used the EntityManager in the service.  It seems to be slowing down our services a good deal.  It takes a very long time to instantiate the EntityManager on every call to the service.  Our services are all Per-Call type.

Any examples or help with speeding up the creation of the EM would be greatly appreciated.



Replies:
Posted By: sbelini
Date Posted: 25-May-2011 at 4:12pm
Hi Tim,
 
A few pointers:
 
1) I’d try setting the CompositionHost.SearchPatterns (in your global.asax?)
While this affects initial startup, it wouldn’t necessarily be the cause of problems as each EM is constructed.However, if the list of probed assemblies is large, that might cause later performance issues.
You can read more about discovery/CompositionHost in the http://drc.ideablade.com/xwiki/bin/view/Documentation/discovery - DevForce Resource Center .
 
2) Also, have in mind that in n-tier every EM will be doing initialization and handshake logic to talk to the EntityServer, overhead that could be avoided if communication with a BOS on another server is not really necessary.
 
3) Every EM will also try to login before anything else is done with it, so you might want to take a look at your IEntityLoginManager logic.
 
4) Check your debug log. It might show the areas that are taking the longest and help you diagnostic the problem.


Posted By: downeytim
Date Posted: 14-Jun-2011 at 1:45pm
This helped a great deal.  I cannot stress how important this is.  It reduced the time to intialize an Entity Manager from 20 seconds to 4 seconds.  In a WCF service call a 20 second initialization is obviously not workable.  Even 4 seconds is a very long time to happen on every call to our servic


Posted By: kpinniger
Date Posted: 11-Jul-2011 at 1:12pm
I have a question about this statement:

1) I’d try setting the CompositionHost.SearchPatterns (in your global.asax?)

When does the CompositionHost.SearchPatterns have to be added?  Just before creation of the EM?  We are currently having one bos server two seperate applications and require that each application adds in their own searchpatterns.
 
Any suggestions would be very much appreciated.
 
Kurt Pinniger


Posted By: sbelini
Date Posted: 11-Jul-2011 at 2:42pm
Hi Kurt,
 
As per the DRC:
 
You need to set the SearchPatterns and IgnorePatterns as early as possible in your application, since as soon as you use the IdeaBladeConfig.Instance, TraceFns and DebugFns methods, or an EntityManager, initialization will automatically occur.
  • In an http://drc.ideablade.com/xwiki/bin/view/Documentation/deploy-entityserver -



Print Page | Close Window