Seeking clarification around web farms and smart search indexes

Tom Troughton asked on August 30, 2016 17:40

I'm hoping someone can clarify something. Say I have a Kentico site running on two servers as part of a web farm. I touch this site for the first time so that web server registers itself in Kentico's web farms module. At the moment the second server has not been registered. Now say I rebuild a smart search index. Of course I can observe the index files changing on the first server, but those files on the second server remain out of date. This is expected because Kentico doesn't yet know about that second server.

Now I touch the site on the second server which registers itself as a second server in Kentico's web farm module in the Transitioning state.

My assumption was that part of this transitioning process would be to synchronize with other web farm servers (i.e. run any web farm tasks that haven't yet been run on this server). However, the second server reaches its Healthy state with its indexes still out of date. So my questions are:

  1. Is this expected behaviour? Or is my web farm not functioning correctly?
  2. If this is expected, how do I ensure smart search indexes stay in sync? For example, should I be writing custom code to ensure search indexes are re-built on app start?

Recent Answers

Brenden Kehren answered on August 30, 2016 17:48

What version are you running? Where are you storing your Smart Search indexes? Have you read my blog on this topic?

0 votesVote for this answer Mark as a Correct answer

Tom Troughton answered on August 30, 2016 18:52

This is Kentico 9, hosted on Azure VMs using shared blob storage for media files only (as per your blog actually). Smart search indexes are therefore stored on local disk of each web server and need to be synchronized by web farm tasks. For the purposes of my question I'm only really interested in ensuring these smart search indexes are always in sync. As far as I can tell this isn't covered in your blog but thank you for the pointer.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 30, 2016 20:31

So in v9, there are options in settings to ensure they are synced across all servers. Make sure those are enabled. Then make sure you clear out the current indexes in the /App_Data/CMSModules/SmartSearch/

2 votesVote for this answer Mark as a Correct answer

Jeroen Fürst answered on August 31, 2016 08:27 (last edited on August 31, 2016 08:28)

Hi Nat,

Please be aware that some scheduled tasks (like execute search tasks) will have to be configured to run on any server in the web farm. I blogged about this: here

Hope this helps! Jeroen

2 votesVote for this answer Mark as a Correct answer

Tom Troughton answered on August 31, 2016 09:34

@Brenden If you're talking about the setting " Versioning & Synchronization > Web farm > Allow synchronization for: Smart search indexes" then this is already checked. As I mentioned, the indexes synchronize fine when all web farm servers are present. But they go out of sync when one server is taklen offline for some time because when that web farm server is re-registered its file system is not automatically updated with latest indexes.

@Jeroen Thanks for your advice. Yes I'm aware of this. Actually our configuration is considerably more complex than I've outlined (dozens of sites over a large web farm for a start) so right now I'm just keen to understand if the behaviour I've described is to be expected. I'm assuming scheduled tasks are not involved in the transitioning process of a new web farm server object.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.