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 marshaling a new instance of the ISearchServiceClient followed by the appropriate ISearchIndexClient for the specific index needed based on the client making the call.
In an effort to increase performance I was thinking about marshaling up ALL of the ISearchIndexClients at application startup and placing them into a Dictionary object:
public static Dictionary<String, SearchIndexClient> SearchIndexes;
so that any specific index can be called up directly from the static Dictionary and used like so:
SearchIndexes["IndexName"].Documents.Search(searchText, searchParameters);
My hope is that this will speed up query and index update times especially on a "hot" index. My concern is that this may introduce memory leaks, performance issues and other unknowns.
I have not seen any examples using a statically available SearchServiceClient or SearchIndexClient so I am a bit uneasy going forward with this approach. My questions to the community are:
- Is my plan sound?
- Will it actually increase performance.
- What are the drawbacks or implications (if any?)
- If the amount of Indexes increases over time (to 60-70 for example) will I start to see drawbacks then?
Would it make more sense to marshal up the SearchServiceClients into a dictionary and connect to the appropriate SearchIndexClient from there as needed like so:
public static Dictionary<String, SearchServiceClient> SearchServices;
var searchIndexClient = SearchServices["ServiceName"].Indexes.GetClient("IndexName");
searchIndexClient.Documents.Search(searchText, searchParameters);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…