Hi Jim,

Proper way to do this would be to have your own Whiteboard
implementation and implement the logic as preset in Oak whiteboard [1]
and the modify the logic around scheduling. However given currently
there is only AsyncIndexing task which requires to be run as a
singleton you can disable the default async indexing and trigger on
your own. Just use IndexMBeanRegistration

> Is there an optimal frequency for indexing that you would recommend?

Default is 5 sec which so far we have seen works fine

> Why doesn’t the checkpoints prevent resource contention?  It would appear to 
> me that they should.

Checkpoint are not meant to prevent contention. AsyncIndexer has an
inbuilt "lease" support to prevent concurrent runs but there have been
some issues like OAK-3436 which can result in complete reindexing at
times! They should be addressed soon


Chetan Mehrotra
[1] 
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java#L247


On Tue, Dec 8, 2015 at 8:45 AM, Jim.Tully <[email protected]> wrote:
> Chetan,
>
> It appears that I can at least trigger the async indexing from within my
> application.  That leaves me with two questions that I hope you can find
> time to answer:
>
> 1.      Is there an optimal frequency for indexing that you would recommend?
> 2.      Why doesn’t the checkpoints prevent resource contention?  It would
> appear to me that they should.
>
> Many thanks,
>
> Jim Tully
>
>
>
>
>
> On 12/7/15, 10:50 AM, "Jim.Tully" <[email protected]> wrote:
>
>>Chetan,
>>
>>I really appreciate the quick response.  Our application is capable of
>>running singleton scheduled jobs already, so I believe I can take care of
>>that aspect.  Would it be as simple as omitting the withAsyncIndexing()
>>argument to the constructor, and then
>>
>>- create an AsyncIndexUpdate instance
>>- schedule the instance to invoke it¹s run() method
>>
>>
>>Jim
>>
>>
>>
>>
>>
>>On 12/7/15, 9:50 AM, "Chetan Mehrotra" <[email protected]> wrote:
>>
>>>On Mon, Dec 7, 2015 at 9:06 PM, Jim.Tully <[email protected]> wrote:
>>>> When running locally with similar data, the indexing is nearly
>>>> instantaneous.
>>>
>>>Okie thats what I was expecting. The problem here is that AsyncIndexer
>>>job is to be run as a singleton in a cluster. This is done at [1].
>>>This is undocumented dependency on Sling way of scheduling things
>>>(SLING-2979) which allows one to schedule jobs as singleton in a
>>>cluster.
>>>
>>>The default scheduler used by Oak (outside of Sling) does not honor
>>>this contract which causes this job to be executed concurrently on
>>>each cluster node and that causes conflict/retries etc. So in a way
>>>Oak is outsourcing the job execution in cluster to embedding
>>>application. Would be good to document this aspect (if you can open an
>>>issue that would be helpful)
>>>
>>>Given the recent work on DocumentDiscoveryLiteService it might be
>>>possible for Oak to manage such thing on its own (@Stefan thoughts?).
>>>But as of now this is not possible. So only way out currently is to
>>>provide your own Whiteboard implementation which can handle such kind
>>>of singleton scheduled jobs. Doing this is certainly non trivial!
>>>
>>>Chetan Mehrotra
>>>[1]
>>>https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/jav
>>>a
>>>/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java#L59
>>>
>>
>

Reply via email to