Vibhath,

Yes, the object itself is shared across those different processors, and the 
object is accessed concurrently by multiple threads.

Is there any impact on performance? This depends entirely on the implementation 
of the Controller Service. If I have a Controller Service with a method named 
“doSomething” and it’s implemented like this:

public String doSomething() {
    return “done”;
}

Then there’s no impact on performance when using multiple threads. But if it’s 
implemented like this:

public String toSomething() {
    lock.lock();
    try {
       return doSomethingExpensive();
    } finally {
        lock.unlock();
    }
}

Then you may have a huge performance penalty because only a single thread at a 
time will perform the action “doSomethingExpensive” and any other threads will 
block, executing only one at a time.

Thanks
-Mark



On Apr 20, 2021, at 7:59 AM, Vibhath Ileperuma 
<[email protected]<mailto:[email protected]>> wrote:

Hi all,

In NIFI user guide, it is mentioned that controller services are shared 
services. What does it exactly mean?
We can use a single service object with multiple processors. For example, we 
can use the same CSVRecordSetWriter with a PartionRecord processor and a 
UpdateRecord processor. Is it like accessing the same java object from multiple 
threads? Is there any negative or positive impact on performance when using 
multiple objects of the same service instead of a single service object?

Thanks & Regards

Vibhath Ileperuma

Graduate | ENTC

University of Moratuwa

E [email protected]<mailto:[email protected]>

M 0772715343


Reply via email to