Implications of using AzureSearch SDK with static Dictionary of 30-40 ISearchIndexClients

后端 未结 1 1924
心在旅途
心在旅途 2021-01-25 03:58

I have an ASP.NET Web Application that uses 30-40 different search indexes across 5-6 search services (various clients are in different pricing tiers).

Currently I am ma

1条回答
  •  鱼传尺愫
    2021-01-25 04:50

    This strategy will probably not scale to the number of indexes you want. The most likely outcome is that you will exhaust the pool of available TCP connections. A better approach would be to implement a cache of SearchIndexClient instances keyed by index name. On a cache miss, you could get exclusive access to the least-recently-used client and set the IndexName property on it. That settable property was added to SearchIndexClient for exactly this scenario (note that it replaces the deprecated TargetDifferentIndex method).

    You can find more discussions and background information about the implications of sharing SearchIndexClients on GitHub, the MSDN forums, and this related StackOverflow question.

    0 讨论(0)
提交回复
热议问题