Search code examples
marklogicmarklogic-8marklogic-7

facet concurrent resolution ?


Is search:search concurrent option for facet calculations runs internally as (many facets resolved on the same core in parallel) or ( each facet resolved on a single core)?

What is the maximum limit to the concurrency-level option? is there any relation between this option and the number of cores?

if the facets resolved on the same core? are they calculated within the same process using multiple threads or each facet resolved as a different process?

is ML7 and ML8 resolving concurrent facets in a different way?

in cts:element-values documentation for "concurrent" option: here

What do u mean by " This is especially useful in cases where multiple lexicon calls occur in the same query (for example, resolving many facets in a single query)" ?

How you defined the same query or single query?

If I need to resolve many facets using cts:element-values without using search:search how I can put them in a "single query" so they can be resolved concurrently?


Solution

  • Each appserver has a configured maximum number of threads.

    The concurrency-level within the query options controls how many threads a query with the REST or Search API may consume (limited by the maximum for the appserver).

    When the query is run, the server allocate threads for facet resolution (up to the lower of the maximum from the query options and the actual number of threads available at that time).

    If there are more facets than threads, resolution of the additional facets is distributed in a balanced way among the threads.

    The server is engineered to take advantage of multiple cores in running threads.

    ML7 and ML8 take the same fundamental approach.

    A query consists of the end-to-end processing of a request, eval, or invoke.

    To execute multiple cts:element-values() requests concurrently, don't access the variables assigned by the calls until after all calls have been executed.

    That said, the Search API is good at concurrent execution of facets, so you might want to take advantage of its capabilities unless you have a pressing reason to do otherwise.