Cache Tuner V2

Hello Everyone, Sorry for being away for a while. I got busy due to personal and professional commitments. But I’m back with lot of new learnings which I’ve planned to share with you.

Cache Tuner is one of my favorite modules [Widely accepted and appreciated by Sitecore community – Thanks for your appreciation, It motivates me to work on weekend to update this module instead of watching India-Australia match 😉], and thought to update it to handle few of the following use cases:

  1. Sitecore 9.1 Compatible : As you know, Sitecore made big architectural changes in Version 8.2 to make Sitecore caching much more better and extensible. But it broke few tools like CacheTuner and so others. In December, updated Cache Tuner to use new API : https://sitecorebasics.wordpress.com/2018/12/25/sitecore-9-compatible-cache-tuner/ While I was working on Cache Tuner V2, Thought to validate it on my Sitecore 9.1 Instance to make sure it works — And it indeed works! So, I have done all my validation on Sitecore 9.1. So, you can try with your new 9.1 instance with confidence. But please remember – If you find something new, Please report it on github or create PR with fix 🙂
  2. Drill down cache and clear specific cache : Since childhood, I’ve been always curious to know – How stuff works? (I’m sure for most of you as well, that’s why you are in this field). Same has been true for Sitecore Caching as well. As you know Sitecore caching uses same structure like HashTable. Where you have Key – Value pair. Along with that, Sitecore also has nested Hashtable. Which means one Key’s Value will also have another hashtable with Key – Value. At times when you are troubleshooting caching challenges, You must have thought of this. Is this caching issue or not? And to do that, Usually, what you do is, Use Sitecore Admin cache page to clear all cache and if it fixes the issue. Then it’s caching issue else it is something else. Sounds similar? You can do this on lower environment. But what if you must do same thing on production environment? During that you must be thinking. What If:
    1. I can see what’s inside each cache entry e.g. Click on YOURSITE[HTML] and see whether component which you are trying to troubleshoot exists or not in that list. I can clear specific Cache instead of FULL Cache e.g. You can just clear YOURSITE[HTML] cache and see whether it fixes your issues or not, Without affecting other caches. If you got excited and say — I know there’s module in marketplace which does exactly same thing – Then I would say cool down, as I also had same excitement, with this module : https://marketplace.sitecore.net/en/Modules/S/Sitecore_Cache_Admin.aspx Which I used a lot, And would like to Thanks this Module Admin. As this feature of Cache Tuner V2 is inspired from this module. But this module is not updated to support new Caching API Changes. Now, All above things are possible with CacheTunerV2 — I believe, This feature will be super helpful to community. And I’m excited to know your feedback on this.
  3. Clear all cache : Instead of relying on Cache Admin page, you can do it using CacheTuner page [Note : Please make sure you delete your cache tuner page, as soon as you are done with your Caching Tuning and troubleshooting. As CacheTuner page is not yet secure page]

Sounds exciting? And curios to know more about this. Let’s do it:

Screenshots:

Clear all Button
If Cache key has value, Then it will be clickable. If you would like to drill down and see what’s inside — please click desired cache key. Which will open Cache Detail page in new window with details of clicked cache key.
Cache detail page for website[html] cache key looks like this. #1 – Shows total number of cache entries stored in clicked cache, #2 – Cache details – In this example it is showing you how HTML Cache is getting stored for each component. #3 – Using “Clear Me!” button you can click particular cache. In this example website[html]

How to use it?

  1. Download from Cache Tuner V2 release : https://github.com/klpatil/CacheTuner/tree/CacheTunerV2 (Take a note of CacheTunerV2 branch and you can refer Release section : https://github.com/klpatil/CacheTuner/releases/tag/CTV2.0)
  2. Copy it under your desired folder. I recommend to have everything under CTV2 folder e.g. Webroot/MyTools/CTV2/* (All Cache Tuner v2 files in same folder)
  3. Access Cache Tuner V2 as per your copied folder e.g. https://<mysite>/mytools/ctv2/cachetuner.aspx
  4. That’s it – Fix you Caching issue and go home, your loved ones are waiting for you!

Hope you found this useful, There are few useful features in my roadmap. Thought to share with you. In case, you want to contribute to module.

Future release:

  1. Add Authorization
  2. Drill down cache details for all types, as of now it only supports few caching types only. And it should handle most of the use cases.
  3. Clear specific cache entry – As of now you can’t clear specific cache entry. You can clear specific cache container. e.g Instead of clearing website[html] would like to have a feature to clear cache entry which is inside website[html]
  4. Anything I missed? I’m all ears!

Old links:

https://sitecorebasics.wordpress.com/2011/04/27/cache-tuner-user-guide/

Thank you so much for reading!

Sitecore Troubleshooting Demos

Challenge:

Have been crafting on Sitecore since a decade and have came up with lot of unique Sitecore challenges.

Which I’ve been sharing with you via this blog, And have received good feedback from you — And I appreciate you for that. If you haven’t came across it yet. Then you can visit following links:

  1. https://sitecorebasics.wordpress.com/category/performance/
  2. https://sitecorebasics.wordpress.com/tag/troubleshooting/
  3. https://www.scribd.com/document/132658804/Sitecore-Troubleshooting-Path

While learning Debugging/Troubleshooting Tess’s blog helped me a lot. Especially Labs (You as well?!) :

https://blogs.msdn.microsoft.com/tess/2008/02/04/net-debugging-demos-information-and-setup-instructions/

Sine long time, I wanted to build something similar for Sitecore community. But most of the times being super busy, and at times being lazy [Happens with you as well!? ;-)]. But when I thought to present at SUGCON India I thought this is the best time to work on this idea! (If you couldn’t attend SUGCON India then you missed a great event — Everyone did a great job to make this happen first time at India. You can see great pictures here : http://www.sugcon.in/2018-pictures/)

I’m excited to share, What I have done with you. Which I already shared at SUGCON India and SUGUAE events.

Solution:

You can get it from here : https://github.com/klpatil/SCbuggybits (Read Me file should help you to get started) This lab contains 3 Bugs in the form of 3 Labs. It will be fun to find it and fix it!

My Session slides are here : http://www.sugcon.in/wp-content/uploads/2018/05/Troubleshoot-Sitecore-Like-a-Ninja-Kiran-Patil-SUGCON-India-2018.pdf

My session video is here :

Give it a try and let me know what you think? You found new bug in your day to day life, And would like to add it scbuggybits, I encourage you to do so!

Hope this helps you to fix your issues and let’s you go home on time! 🙂

Basic ways to troubleshoot Sitecore indexing configurations

Challenge:

Few months back, we were facing Indexing related challenges. CM and CD indexes were different. During that period we learnt some way to identify how to troubleshoot Sitecore indexing. I thought it will be good idea to share with you folks as well

Solution:

We’ve built a simple pag which prints important index information as shown below:

2015-11-21 12_59_59-Test PageCode is very straight forward:

ISearchIndex isearchIndex = ContentSearchManager.GetIndex("YOURINDEXTOTROUBLESHOOTNAME");

if (isearchIndex != null)
{
	stringBuilder.AppendFormat("Index Found {0}. Details are as under",
	qsIndexName);
	stringBuilder.Append(" ");

	stringBuilder.AppendFormat("Index Name : {0}  ",
	isearchIndex.Name);                              
	stringBuilder.AppendFormat("Index IsClean : {0}  ",
	isearchIndex.Summary.IsClean);
	stringBuilder.AppendFormat("Index  IsHealthy: {0}  ",
	isearchIndex.Summary.IsHealthy);
	stringBuilder.AppendFormat("Index  IsOptimized: {0}  ",
	isearchIndex.Summary.IsOptimized);
	stringBuilder.AppendFormat("Index  LastUpdated: {0}  ",
	isearchIndex.Summary.LastUpdated);
	stringBuilder.AppendFormat("Index  NumberOfDocuments: {0}  ",
	isearchIndex.Summary.NumberOfDocuments);
	stringBuilder.AppendFormat("Index  NumberOfFields: {0}  ",
	isearchIndex.Summary.NumberOfFields);
	stringBuilder.AppendFormat("Index  NumberOfTerms: {0}  ",
	isearchIndex.Summary.NumberOfTerms);
	stringBuilder.AppendFormat("Index  OutOfDateIndex: {0}  ",
	isearchIndex.Summary.OutOfDateIndex);                              

}
else
{
	stringBuilder.AppendFormat("Index Not Found : {0}",
	qsIndexName);
	stringBuilder.Append(" ");
}

Make sure you have page with this code on your CM and CD. And pass your index name which
you are trying to troubleshoot. Then make a change in your Sitecore Content tree like add one item and then check on CM you should see one more document.

Now, publish it and check index info on CD Server  it should increase document count on CD as well. If not then it means your index configurations are not proper. And usually we do check following things:

  1. Check your Sitecore.ContentSearch.Lucene.Index.<DBNAME> file and ensure right Index strategies are configured  : http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/04/sitecore-7-index-update-strategies.aspx and usually people add new publish target. But forget to add index strategy
  2. Second thing is verify your EventQueue and History Engine configurations. Because Sitecore relies on it. Good to read : http://sitecoreblog.blogspot.in/2012/02/remote-events-how-to-investigate.html and i can recall once our indexes were not getting built and running following SQL Statements on each database fixed it :
DELETE FROM EventQueue;
DELETE FROM [Properties] WHERE [Key] LIKE 'EQStamp%'; 

I missed any scenario? Feel free to add

Reference:

  1. http://kamsar.net/index.php/2014/01/have-two-web-databases-dont-forget-the-indexupdatestrategy/
  2. http://stackoverflow.com/questions/25692932/sitecore-lucene-content-delivery-server-index-not-updating-on-publish
  3. http://sitecoreblog.alexshyba.com/search_index_troubleshooting/

Happy Indexing! 🙂

Sitecore Troubleshooting Path

Challenge:

We have invested a lot of time in troubleshooting Sitecore challenges, e.g. CM/CD/PI is slow, CM/CD/PI is crashed, CM/CD/PI is slow etc.

When we started working on these challenges, we had either no path to look at OR lot of paths to look at. And trust me it has been always fun and learning to work on such challenges, It teaches you a lot! And when you fix it, you really feel great!

During our journey (“Performance is a Journey, not a Destination”) we learnt the lot of new  things by doing few things that were right and doing few things that were wrong! Right/wrong they were need of the time!

And the sole purpose of writing this post is to share our learning with you! (“Knowledge shared is knowledge gained!”) So, you may not face the challenges which we faced while working on these challenges.

Solution:

Just a note : Before, we start one thing I would like to share with you, which is not technical. But it is as important as technical knowledge. When you troubleshoot any challenge, things might be burning. Because your live servers are down. People looking at you for solution. You are getting chased for solution. Whatsoever happens, keep your self cool and calm!. This is the most basic required thing to troubleshoot and solve any challenge (Virtual/Real world!). And always Stick to your basics! Wish you luck! I’m sure you will solve it!

There are plenty of things to share, and was wondering what will be the best way to write an article which will share knowledge with you in an interesting way! And as someone rightly said “A picture is worth a thousand words“. Finalized to create a poster which will describe Sitecore Troubleshooting Path. Eager to see it?!, here you go!:

You can have a quick look from below and if you find it interesting then only you can download from link given in left side of preview area 🙂

Sounds simple, correct? Let me explain few basic things, how this poster has been designed:

Environments:

  • CM – CM stands for Content Management server, a server which is responsible for your content editing and content management.
  • PI – PI stands for Publishing Instance server, a server which is responsible for your publishing operation only!
  • CD – CD stands for Content Delivery server, a server which is responsible for serving your front-end/live content only!

Troubleshooting source detailed information:

  1. Sitecore log – Sitecore log file from your data folder. Good to use Log Parser Lizard/SCLogExplorer/Sitecore’s log analysis tool for analyzing SC log files.
  2. Sitecore Diagnostics Log – Sitecore Diagnostics log, for more information, please refer earlier post — https://sitecorebasics.wordpress.com/2011/07/30/basics-of-counterdumpagent/
  3. Sitecore configurations – Your sitecore configurations.
  4. Windows Event Log – Windows event log files
  5. IIS Log — IIS logs, in some case if your server becomes slow/gets crashed, it may due to one of the page which is having a rendering which may cause slowness or crash. But you need to build URL pattern to conclude from this source. And good to use Log Parser Lizard for analyzing IIS log files.
  6. Performance counters – Performance counters, you can use PAL to generate reports easily!
  7. Server configurations – Your server configurations, If your CM/CD becomes slow at particular time. Do check that is there any windows service/scheduled task/Scheduled Antivirus scan runs on that particular time.
  8. SQL Server (Performance counters, System usage) or Optimize Sitecore databases (DB cleanup, Rebuild,  etc.) – Your SQL server performance. Good to check CMS Performance Tunning guide or http://sdn.sitecore.net/Scrapbook/Optimizing%20Sitecore%20Performance.aspx
  9. Database Test Page results (/sitecore/admin/DatabaseTest.aspx) – DatabaseTest page from Sitecore,  for more information, please refer earlier post – DatabaseTest
  10. Is cache tuning required? /sitecore/admin/cache.aspx or Cachetuner.aspx- Cache tuning is required?,  for more information, please refer earlier post on Cache Tuning
  11. Your Custom code – If possible disable it and check it, else do logging for it, deploy it and verify – It might be due to custom code, if possible disable it and check it or do detailed logging and verify.
  12. Sitecore Debugger/Profiling –  for more information, please refer earlier post, Basics of Sitecore Debugger
  13. Sitecore Admin Pages (Cache.aspx, Stats.aspx,  Showconfig.aspx) – Nice post Sitecore admin pages explained
  14. Monitoring tool if any e.g. New Relic — New Relic is APM
  15. Your environment e.g. Network, Load Balancer, Local Switch, If your servers are on VM then VM performance and other  Information from your Hosting provider.
  16. Memory Dump – If you are new to Memory Dump and Crash Dump, then I would suggest you to read Ekaterina, Tess and Muktesh‘s blog. Basically, using DebugDiag you can generate dump automatically/manually and using WinDbg and SOS.dll you can analyze what was the root cause of your challenge. Initially you will find it bit complex. But once you got to know it you will be the champ! [Similar as Maths! :-)]
  17. Crash Dump
  18. MemoryThreshold related details from Sitecore log file – It is not good idea to use this if you are hosting multiple websites from single Sitecore – For more information, please refer earlier post – Threshold exceeds and MemoryMonitorHook
  19. Cache Debug related information from Sitecore log file (Caching.DebugEnabled) —  For more information, please refer earlier post – Caching Debug
  20. Detailed event level details from Sitecore log file (events timingLevel=”high”) –  For more information, please refer earlier post – EventQueue troubleshooting
  21. IIS worker process configuration – Idle Timeout may shutdown your Worker process, if not configured properly.Also, it’s always good to run your SC worker Process on 64 bit —  For more information, please refer earlier post – KeepAlive, CD server crash
  22. GC mode – server or workstation? –  For more information, please refer earlier post – Do you really need AccessResultCache on CD Server?
  23. System usage – CPU, Memory etc.
  24. Any custom/Sitecore agent causing issues?

Hope this helps!

Eager to listen your views/suggestions/comments/feedback.

Happy Sitecore Troubleshooting! 🙂

Worth to read :

http://blog.navigationarts.com/sitecore-performance-analysis-profiling-debugging-caching-more/
https://sitecorebasics.wordpress.com/category/performance/
https://sitecorebasics.wordpress.com/category/caching/
https://sitecorebasics.wordpress.com/category/publishing/

Sitecore login page error : No such host is known

Challenge:

Dear Readers, Apologize for not sharing anything with you since so long. As was bit busy with projects. (But It’s good to be busy. Because during your busy time you learn a lot, and needless to say once you get time you will have a lot to share!). So, don’t worry I’ve lot to share and have created a list of blogs to share with you.

Today, one of my colleague faced “No such host is known” error, and I faced it so earlier and found solution for it as well (What, you are also facing the same error? And searching for a solution? calm down, We’ve solution for you!). At that time he told you should post it. And it inspired me to write this blog post.

Server Error in ‘/’ Application.


No such host is known

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: No such host is known

Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

 

[SocketException (0x2af9): No such host is known]
   System.Net.Dns.GetAddrInfo(String name) +471
   System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6) +121
   System.Net.Dns.GetHostEntry(String hostNameOrAddress) +109
   Sitecore.Web.WebUtil.GetHostIPAddress() +76
   Sitecore.Login.LoginPage.RenderStartPage() +131
   Sitecore.Login.LoginPage.OnPreRender(EventArgs e) +216
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

Solution:

When we faced this error earlier we fixed it by  enabling “use NETBIOS over TCPIP” from network settings is not as given in this link — http://www.mycsharpcorner.com/Post.aspx?postID=28

and it fixed our issue and same for my colleague too!

But today, did a quick search on forum and web and people have suggested different solutions. Which you can also try if above given solution doesn’t works for you:

http://sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?postid=25359

http://sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?postid=20560

http://sitecoreblog.alexshyba.com/2010/01/no-such-host-is-known.html

Please do share, which way worked for you!

Happy Login to Sitecore! 🙂