"3/12/2012 11:34:27 AM Edited
The multiple diagrams feature does help increase the responsiveness of the designer but for a model this large it is still not very usable. The model has 266 EntityTypes and 710 Relationships.
These timings were done manually with a stopwatch:
Open File for first Time: 20 seconds
Move To New Diagram : 7-15 seconds
Add Related: 5-7 seconds
Rename Entity: 6-7 seconds
2/21/2012 7:44:00 AM Created
One of our customer is trying to manipulate / modify a large EDMX file with VS 2010 it takes a long time (~ 3- 5 mins) to process accompanied with large CPU for the first time.
We see this issue when we try to change any names of an entity / create an association from the designer.
I went through the following blogs:
http://blogs.msdn.com/b/adonet/archive/2008/11/24/working-with-large-models-in-entity-framework-part-1.aspx
http://blogs.msdn.com/b/adonet/archive/2008/11/24/working-with-large-models-in-entity-framework-part-2.aspx
Customer has implemented some of the suggestions from the blog but the performance problem still persists. For business constraints customer is not in a position to break the EDMX.
Wanted to check if this performance problem will be fixed in coming release of entity framework.
Also any other best practices that we can suggest to the customer will be of great help.
Troubleshooting and workaround
===============================
Here is the detail cause and workaround for this issue:
We found the high CPU usage did not occur the first time an EDMX file was loaded with no nodes under <edmx:Diagram>. Any save of the EDMX would write those nodes out based on the designer layout. Subsequent edits of the EDMX would experience high CPU usage. I suspect it is due to poor XML parsing/processing performance of the nodes under <edmx:Diagram>.
Workaround:
Add this PropertyGroup/UsingTask/Target to end of the .csproj containing the EDMX (the project is under TFS source control, so we only want to transform the EDMX if it is checked-out/writable during the project build):
<PropertyGroup>
<EntityDeployDependsOn>
$(EntityDeployDependsOn)
RemoveEdmxDiagram
</EntityDeployDependsOn>
</PropertyGroup>
<UsingTask TaskName=""IsFileReadOnly"" TaskFactory=""CodeTaskFactory"" AssemblyFile=""$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"">
<ParameterGroup>
<FileName ParameterType=""System.String"" Required=""true"" />
<IsReadOnly ParameterType=""System.Boolean"" Output=""true"" />
</ParameterGroup>
<Task>
<Using Namespace=""System.IO"" />
<Code Type=""Fragment"" Language=""cs""><![CDATA[ this.IsReadOnly = new FileInfo(this.FileName).IsReadOnly; ]]></Code>
</Task>
</UsingTask>
<Target Name=""RemoveEdmxDiagram"">
<IsFileReadOnly FileName=""%(EntityDeploy.Identity)"">
<Output PropertyName=""IsEdmxReadOnly"" TaskParameter=""IsReadOnly"" />
</IsFileReadOnly>
<Copy SourceFiles=""%(EntityDeploy.Identity)"" DestinationFiles=""$(TEMP)\%(EntityDeploy.Identity)"" Condition=""!$(IsEdmxReadOnly)"" />
<Message Text=""Removing Diagram Nodes from %(EntityDeploy.Identity)..."" Condition=""!$(IsEdmxReadOnly)"" />
<XslTransformation XmlInputPaths=""$(TEMP)\%(EntityDeploy.Identity)"" XslInputPath=""RemoveDiagramNodes.xslt"" OutputPaths=""%(EntityDeploy.Identity)"" Condition=""!$(IsEdmxReadOnly)"" />
<Message Text=""Removed Diagram Nodes from %(EntityDeploy.Identity)."" Condition=""!$(IsEdmxReadOnly)"" />
<Delete Files=""$(TEMP)\%(EntityDeploy.Identity)"" Condition=""!$(IsEdmxReadOnly)"" />
</Target>
</Project>
This is the contents of RemoveDiagramNodes.xslt:
<?xml version=""1.0"" encoding=""utf-8""?>
<xsl:stylesheet version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform""
xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" exclude-result-prefixes=""msxsl""
>
<xsl:output omit-xml-declaration=""yes""/>
<!-- Copy all nodes by default -->
<xsl:template match=""node()|@*"">
<xsl:copy>
<xsl:apply-templates select=""node()|@*"" xml:space=""preserve""/>
</xsl:copy>
</xsl:template>
<!-- Do not copy/process any nodes under the Diagram node. -->
<xsl:template xmlns:edmx=""http://schemas.microsoft.com/ado/2008/10/edmx"" match=""edmx:Diagram/*"" />
<!-- Collapse all the white space under the Diagram node -->
<xsl:strip-space xmlns:edmx=""http://schemas.microsoft.com/ado/2008/10/edmx"" elements=""edmx:Diagram""/>
</xsl:stylesheet>
"
This item was migrated from the DevDiv work item tracking system [ID=367508].
The multiple diagrams feature does help increase the responsiveness of the designer but for a model this large it is still not very usable. The model has 266 EntityTypes and 710 Relationships.
These timings were done manually with a stopwatch:
Open File for first Time: 20 seconds
Move To New Diagram : 7-15 seconds
Add Related: 5-7 seconds
Rename Entity: 6-7 seconds
2/21/2012 7:44:00 AM Created
One of our customer is trying to manipulate / modify a large EDMX file with VS 2010 it takes a long time (~ 3- 5 mins) to process accompanied with large CPU for the first time.
We see this issue when we try to change any names of an entity / create an association from the designer.
I went through the following blogs:
http://blogs.msdn.com/b/adonet/archive/2008/11/24/working-with-large-models-in-entity-framework-part-1.aspx
http://blogs.msdn.com/b/adonet/archive/2008/11/24/working-with-large-models-in-entity-framework-part-2.aspx
Customer has implemented some of the suggestions from the blog but the performance problem still persists. For business constraints customer is not in a position to break the EDMX.
Wanted to check if this performance problem will be fixed in coming release of entity framework.
Also any other best practices that we can suggest to the customer will be of great help.
Troubleshooting and workaround
===============================
Here is the detail cause and workaround for this issue:
We found the high CPU usage did not occur the first time an EDMX file was loaded with no nodes under <edmx:Diagram>. Any save of the EDMX would write those nodes out based on the designer layout. Subsequent edits of the EDMX would experience high CPU usage. I suspect it is due to poor XML parsing/processing performance of the nodes under <edmx:Diagram>.
Workaround:
Add this PropertyGroup/UsingTask/Target to end of the .csproj containing the EDMX (the project is under TFS source control, so we only want to transform the EDMX if it is checked-out/writable during the project build):
<PropertyGroup>
<EntityDeployDependsOn>
$(EntityDeployDependsOn)
RemoveEdmxDiagram
</EntityDeployDependsOn>
</PropertyGroup>
<UsingTask TaskName=""IsFileReadOnly"" TaskFactory=""CodeTaskFactory"" AssemblyFile=""$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"">
<ParameterGroup>
<FileName ParameterType=""System.String"" Required=""true"" />
<IsReadOnly ParameterType=""System.Boolean"" Output=""true"" />
</ParameterGroup>
<Task>
<Using Namespace=""System.IO"" />
<Code Type=""Fragment"" Language=""cs""><![CDATA[ this.IsReadOnly = new FileInfo(this.FileName).IsReadOnly; ]]></Code>
</Task>
</UsingTask>
<Target Name=""RemoveEdmxDiagram"">
<IsFileReadOnly FileName=""%(EntityDeploy.Identity)"">
<Output PropertyName=""IsEdmxReadOnly"" TaskParameter=""IsReadOnly"" />
</IsFileReadOnly>
<Copy SourceFiles=""%(EntityDeploy.Identity)"" DestinationFiles=""$(TEMP)\%(EntityDeploy.Identity)"" Condition=""!$(IsEdmxReadOnly)"" />
<Message Text=""Removing Diagram Nodes from %(EntityDeploy.Identity)..."" Condition=""!$(IsEdmxReadOnly)"" />
<XslTransformation XmlInputPaths=""$(TEMP)\%(EntityDeploy.Identity)"" XslInputPath=""RemoveDiagramNodes.xslt"" OutputPaths=""%(EntityDeploy.Identity)"" Condition=""!$(IsEdmxReadOnly)"" />
<Message Text=""Removed Diagram Nodes from %(EntityDeploy.Identity)."" Condition=""!$(IsEdmxReadOnly)"" />
<Delete Files=""$(TEMP)\%(EntityDeploy.Identity)"" Condition=""!$(IsEdmxReadOnly)"" />
</Target>
</Project>
This is the contents of RemoveDiagramNodes.xslt:
<?xml version=""1.0"" encoding=""utf-8""?>
<xsl:stylesheet version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform""
xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" exclude-result-prefixes=""msxsl""
>
<xsl:output omit-xml-declaration=""yes""/>
<!-- Copy all nodes by default -->
<xsl:template match=""node()|@*"">
<xsl:copy>
<xsl:apply-templates select=""node()|@*"" xml:space=""preserve""/>
</xsl:copy>
</xsl:template>
<!-- Do not copy/process any nodes under the Diagram node. -->
<xsl:template xmlns:edmx=""http://schemas.microsoft.com/ado/2008/10/edmx"" match=""edmx:Diagram/*"" />
<!-- Collapse all the white space under the Diagram node -->
<xsl:strip-space xmlns:edmx=""http://schemas.microsoft.com/ado/2008/10/edmx"" elements=""edmx:Diagram""/>
</xsl:stylesheet>
"
This item was migrated from the DevDiv work item tracking system [ID=367508].