Troubleshooting slow BIML solutions
Large biml solutions might be slow.
<Biml> <Annotations> <Annotation AnnotationType="CodeComment">2016-12-14T13:20:52 FirstFile start time</Annotation> <Annotation AnnotationType="CodeComment">2016-12-14T13:20:52 SecondFile start time</Annotation> <Annotation AnnotationType="CodeComment">2016-12-14T13:25:54 AnotherFile start time</Annotation> <Annotation AnnotationType="CodeComment">2016-12-14T13:27:22 Debug start time</Annotation> </Annotations> </Biml>
Thanks to Cathrine Wilhelmsen for leading me into this
https://www.cathrinewilhelmsen.net/biml/
These steps are good to take to be able to pinpoint slow spots.
Create Debug.biml
Add debug.biml last to your project.
As there is no way to get the name of the current file in BIML we use a hack that requires at least one other biml-file containing at least one connection tag to be generated.
As there is no way to get the name of the current file in BIML we use a hack that requires at least one other biml-file containing at least one connection tag to be generated.
<#@ template language="C#" tier="900" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Xml" #>
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Annotations>
<Annotation AnnotationType="CodeComment"><#=DateTime.Now.ToString("s")#> Debug start time</Annotation>
</Annotations>
<#
string xBiml = RootNode.GetBiml();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xBiml);
if (RootNode.Connections.Count == 0 )
throw new Exception("Debug.biml cannot be executed on its own. Shift+mark all biml-files and choose Generate Ssis packages. At least one of these biml files need at least one connection tag");
string bimlFilePath = System.IO.Directory.GetParent(RootNode.Connections[0].BimlFile.FilePath).FullName;
string sFile = String.Format(@"{0}\{1}",bimlFilePath, @"debug.CompiledBiml.xml");
//throw new Exception(sFile);
xmlDoc.Save(sFile);
#>
</Biml>
When generating packages from your biml-files, include debug.biml and a file called debug.CompiledBiml.xml is created. Add it to your miscellaneous files in your project for easy access.
Create log timer entries
<Annotations>
<Annotation AnnotationType="CodeComment"><#=DateTime.Now.ToString("s")#> MyFile start time</Annotation>
</Annotations>
Examine debug.CompiledBiml.xml
This will output timer rows as comments in your debug.CompiledBiml.xml in like fashion:<Biml> <Annotations> <Annotation AnnotationType="CodeComment">2016-12-14T13:20:52 FirstFile start time</Annotation> <Annotation AnnotationType="CodeComment">2016-12-14T13:20:52 SecondFile start time</Annotation> <Annotation AnnotationType="CodeComment">2016-12-14T13:25:54 AnotherFile start time</Annotation> <Annotation AnnotationType="CodeComment">2016-12-14T13:27:22 Debug start time</Annotation> </Annotations> </Biml>
Thanks to Cathrine Wilhelmsen for leading me into this
https://www.cathrinewilhelmsen.net/biml/
Findings
CallBimlScript() function is insanely slow in VS2013+Bids Helper
Comments