Support Questions

Find answers, ask questions, and share your expertise

Can NiFi handle multiple users hitting a request?

avatar
Contributor

Can NiFi handle multiple users hitting a request? Say I have HandleHttpRequest or a ListenHttp processor and my requirement is to handle say 100 concurrent users. Can we do it in NiFi?

 

1 ACCEPTED SOLUTION

avatar
Master Mentor

@AlokKumar 

The simple answer is it is possible.  both the ListenHTTP and HandleHTTPRequest processors create an embedded Jetty server with a default 200 threads for handling inbound http requests.   The Concurrent Tasks are used to covert the http requests into NiFi FlowFiles. 

The HandleHTTPRequest processor also requires a HandleHTTPResponse processor.  The HandleHTTPRequest processor also has a configurable "Container Queue Size" (default 50).

I would recommend using the HandleHTTPRequest and HandleHTTPResponse processors.
I would increase the "Container Queue Size" to 100.  I would increase the Concurrent tasks to maybe 5 and monitor your throughput (Avoid just setting some high value here. Should only increment slowly as you monitor cpu load average and throughput performance). Keep in mind that concurrent tasks are requesting threads from the NIFi Max Timer Driven thread Pool (default: 10) that you would also need to increase (typical starting value is 2 to 4 times the number of CPU cores on your NiFi node).

I say above is the "simple" answer since this is probably not the only dataflow running on your NiFi.  Every component has dome impact in CPU load average (some significant and other almost non-measurable).  So the key here is monitor CPU load average, disk I/o, and network performance and adjust your NiFi component concurrent tasks incrementally keeping in this in mind to maximize your CPU usage to maximize your throughput.  If you exhaust your available CPU or Disk I/O, those may limit your capabilities more then NiFi processors do.  This is a task of tuning and monitoring and tuning again.

Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt



View solution in original post

2 REPLIES 2

avatar
Master Mentor

@AlokKumar 

The simple answer is it is possible.  both the ListenHTTP and HandleHTTPRequest processors create an embedded Jetty server with a default 200 threads for handling inbound http requests.   The Concurrent Tasks are used to covert the http requests into NiFi FlowFiles. 

The HandleHTTPRequest processor also requires a HandleHTTPResponse processor.  The HandleHTTPRequest processor also has a configurable "Container Queue Size" (default 50).

I would recommend using the HandleHTTPRequest and HandleHTTPResponse processors.
I would increase the "Container Queue Size" to 100.  I would increase the Concurrent tasks to maybe 5 and monitor your throughput (Avoid just setting some high value here. Should only increment slowly as you monitor cpu load average and throughput performance). Keep in mind that concurrent tasks are requesting threads from the NIFi Max Timer Driven thread Pool (default: 10) that you would also need to increase (typical starting value is 2 to 4 times the number of CPU cores on your NiFi node).

I say above is the "simple" answer since this is probably not the only dataflow running on your NiFi.  Every component has dome impact in CPU load average (some significant and other almost non-measurable).  So the key here is monitor CPU load average, disk I/o, and network performance and adjust your NiFi component concurrent tasks incrementally keeping in this in mind to maximize your CPU usage to maximize your throughput.  If you exhaust your available CPU or Disk I/O, those may limit your capabilities more then NiFi processors do.  This is a task of tuning and monitoring and tuning again.

Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt



avatar
Contributor

Thanks