Tuesday, January 3, 2012

XSLT In BizTalk Maps

XSLT is by default used by BizTalk maps (XSLT engine) to transform source schema to destination schema so there is nothing new (If you just open the .cs file of a map you can see it clearly there) Intention of this post is to highlight different usages of custom XSLT.

1) WHEN to use XSLT ?
I would prefer to use XSLT in following scenarios,
Whenever you have implement a complex logic in map. Like Grouping, Sorting or joining multiple input messages or carrying out operations with those multiple messages etc.

2) WHY XSLT and not Functoids ?
I totally understand that these things can be done using functoids as well. But as per my expereince if you open a map which uses a lot of functoids and try to analyse the .cs file of a map you will realise that,
i) There are a lot of simplifications can be done in that code like inline xslt functions can be used but instead functoids create .net functions for them.
ii) Also lot of unnecessary variables are created in XSLT which is by default generated by functoids.
iii) If you can write a good xslt you can write much more optimized.(Learning XSLT is pretty simple I would say.) Which in turn positively going to impact on your map execution performance.
iv) Debugging XSLT independantly is very easy infact the Map debugging feature introduced in BizTalk intern uses the same XSLT debug functionality (remember the XSLT debug window which is opened at time of debugging a Map). You can keep you xslt seperate (custom xslt) and test it with your sample input messages independantly.

3) What is Extension XML ? When to use it ?
When you need to call external assembly you will need the reference to extension xml. Link below will explain the details of extension xml.
http://msdn.microsoft.com/en-us/library/aa547368.aspx.

4) XSLT Grouping ,Sorting samples.
Some typical samples of xslt grouping,
e.g. Input message is






















This needs to be Grouped and Sorted we can use an XSLT as below,














and the Output will be















5) Different XSL Functions :-
Below link gives description of some of the XSLT 1.0 functions,
http://www.zvon.org/xxl/XSLTreference/Output/xpathFunctionIndex.html



Imp Note:- As of now Microsoft only supports XSL 1.0, XSL 2.0 is much more powerful and contains a lot of functions compared to 1.0. My Wishlist would include support for XSL 2.0 from Microsoft in future versions of XSLT engine.

Monday, January 2, 2012

Host Throttling Experience - The published message could not be routed because no subscribers were found

"The published message could not be routed because no subscribers were found".. This is the error that every BizTalk developer has seen sometime or the other and most common reason that is seen is either send port or orchestration is not enlisted etc.

I am sharing my experience where i have seen this happening under severe load. I am talking about load of thousands (more than 60K) users per second, Each user was instantiating a web service call(it was required functionality). Everything was working fine for small load but as the load was increased beyond limit (forgot the exact users at that time) we started getting this error.

Resolution:-
After in depth analysis we came to know it was a Host throttling issue. Because the subscribers could not subscribe the published messages (Delivery Throttling). We started to monitor the performance counters and observed that the alloted Memory to BizTalk process was getting consumed fully. We Increased the Process Memory usage to 75% in host throttling settings and the issue got fixed :).

Conclusion - When you see "The published message could not be routed because no subscribers were found" this error at high load one of things you should check is monitor the performance counter for process momory usage (obviously first step will be to check whether the subscribers are enlisted or not :).)

Throttling details have been very well explained by Tord at http://biztalkadmin.com/biztalk-self-throttling/
& on MSDN at
http://msdn.microsoft.com/en-us/library/aa559893.aspx

I hope this post might be helpful If anyone of you ever face this issue anytime.


- Have a Great Time
Shailesh Kawade

Tuesday, December 20, 2011

Dealing With BizTalk High CPU Issues - on Non Prod Environments

Many a times when we are working on DEV machines or testing applications on QA machines we face issues like CPU is shooting very high. Here are couple of things that we tried and were helpful to deal with these issues.

1) Check to see if BizTalk databases size has grown high.
If Yes you can follow these steps.

Step1:- Cleanup BizTalkDTA database
a) Run "dtasp_purgeAllcompletedtrackingdata" procedure from DTA db. (make a note that it will delete all tracked data)
b) Run command "BACKUP LOG BizTalkDTADb WITH TRUNCATE_ONLY" on DTA db.
c) Run command "DBCC shrinkdatabase (BizTalkDTADb)" on DTA db.
d) Run command "DBCC SHRINKFILE('BizTalkDtaDb');" on DTA db.

Step2:- Cleanup BizTalk MessageBox database.
a) Run "msgbox_cleanup_logic.sql" from "/Program Files (x86)/Microsoft BizTalk Server /Schema" folder.
b) Run "bts_CleanupMsgBox" procedure from MessageBox db.
c) Run command "DBCC shrinkdatabase (BizTalkMsgBoxDb)" on MsgBox db.
d) Run command "DBCC SHRINKFILE('BizTalkMsgBoxDb');" on MsgBox db.

2) Check if its Tracking related Issues.
If database size is small but still CPU is shooting high then check to see following

Step 1:- Tracking is enabled on multiple hosts. If Yes then i would suggest to keep tracking enabled on single host (possibly create a dedicated host for tracking). Issues have been observed on environments where tracking is enabled on multiple hosts.

Steps 2:- Check to see if the issue lies with tracking data not getting moved properly as suggested in http://www.biztalkbill.com/Home/tabid/40/EntryId/91/Issues-with-Tracking-causing-high-CPU-usage-on-BizTalk-SQL-Server.aspx

Imp Note:- Please make a note that the data in databases might get lost and the intention of this blog is to cleanse the system so that the development and testing can start freshly without any issues on server.


- Have a Great Time
Shailesh Kawade