<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Nifi is responding SERVICE_UNAVAILABLE  when api request volume is little high in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384768#M245477</link>
    <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2024 10:20:29 GMT</pubDate>
    <dc:creator>hegdemahendra</dc:creator>
    <dc:date>2024-03-08T10:20:29Z</dc:date>
    <item>
      <title>Nifi is responding SERVICE_UNAVAILABLE  when api request volume is little high</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384553#M245413</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;We are using Nifi for data ingestion via http - using '&lt;SPAN&gt;HandleHttpRequest&lt;/SPAN&gt;' processor.&lt;/P&gt;&lt;P&gt;Data is getting ingested continuously but once in a while when incoming volume is little high we get 'Service Unavailable - 503' error from nifi end point.&lt;/P&gt;&lt;P&gt;Below is the log we see in nifi app logs -&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2024-03-04 11:20:25,558 WARN [StandardHttpContextMap-c2ffb1fd-2c09-3a90-0e5e-18384499605f] o.a.nifi.http.StandardHttpContextMap StandardHttpContextMap[id=c2ffb1fd-2c09-3a90-0e5e-18384499605f] Request from 10.13.2.204 timed out; responding with &lt;STRONG&gt;SERVICE_UNAVAILABLE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Imp configs :&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[HandleHttpRequest processor]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Container Queue Size : 2000&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[StandardHttpContextMap controller service]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maximum Outstanding Requests : 8000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Request Expiration : 3min&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;nifi.web.jetty.threads=200 (in nifi.properties)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maximum Timer Driven Thread Count = 200&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Total number of running processors on this env :&amp;nbsp;4200+&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This nifi is running on 8 core machine (ec2 instance)&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we look at the CPU usage during the issue we dont see a cpu usage is more than 40%&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hegdemahendra_0-1709620472971.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39951i1B4C25421F557815/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hegdemahendra_0-1709620472971.png" alt="hegdemahendra_0-1709620472971.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me to understand the issue and the fix?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mahendra&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 08:42:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384553#M245413</guid>
      <dc:creator>hegdemahendra</dc:creator>
      <dc:date>2024-03-05T08:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi is responding SERVICE_UNAVAILABLE  when api request volume is little high</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384589#M245425</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;- requesting your opinion here (if possible)&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 16:46:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384589#M245425</guid>
      <dc:creator>hegdemahendra</dc:creator>
      <dc:date>2024-03-05T16:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi is responding SERVICE_UNAVAILABLE  when api request volume is little high</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384675#M245455</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/37332"&gt;@hegdemahendra&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The Service Unavailable response to a request received by the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.25.0/org.apache.nifi.processors.standard.HandleHttpRequest/index.html" target="_blank"&gt;HandleHTTPRequest&lt;/A&gt; processor is most commonly the result of the FlowFile produced by the HandleHTTPRequest processor not being processed by a downstream &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.25.0/org.apache.nifi.processors.standard.HandleHttpResponse/index.html" target="_blank"&gt;HandleHTTPResponse&lt;/A&gt; processor before the configured Response Expiration configured in the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-http-context-map-nar/1.25.0/org.apache.nifi.http.StandardHttpContextMap/index.html" target="_blank"&gt;StandardHTTPContextMap&lt;/A&gt; controller service.&amp;nbsp; &amp;nbsp;This aligns with the shared exception you shared from the NiFi logs.&amp;nbsp; If you are seeing this exception prior to the 3 minutes expiration you set, it is possible your client is closing the connection due to some client timeout.&amp;nbsp; That you could need to look at your client sending the requests to get details and options.&lt;BR /&gt;&lt;BR /&gt;You mentioned you have 4200+ processors that are scheduled based on their individual configurations.&amp;nbsp; When a processor is scheduled it requests a thread from the configured Maximum TimerDriven Thread Count pool of threads.&amp;nbsp; So you can see that not all processor can execute concurrently which is expected.&amp;nbsp; You also have only 8 cores so assuming hyper-threading you are looking at the ability to actually service only 16 thread concurrently.&amp;nbsp; So what you have happing is time slicing where all your up to 200 concurrently scheduled threads are gets bits of time on the CPU cores.&amp;nbsp; Good to see you looked at your core load average which is very important as it helps you determine what is a workable size for your thread pool.&amp;nbsp; If you have a lot of cpu intensive processor executing often, your CPU load average is going to be high.&amp;nbsp; For you I see a good managed CPU usage with some occasional spikes.&lt;BR /&gt;&lt;BR /&gt;I brought up above as it directly relates to your processor scheduling.&amp;nbsp; The HandleHTTPRequest processor creates a web server that accepts inbound requests.&amp;nbsp; These request will stack-up within that web service as the processor executed threads read those and produce a FlowFile for each request.&amp;nbsp; How fast this can happen depends on available threads and concurrent task configuration on HandleHTTPRequest processor &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#scheduling-tab" target="_blank"&gt;scheduling tab&lt;/A&gt;.&amp;nbsp; &amp;nbsp;By default an added processor only has 1 concurrent task configured.&amp;nbsp; If you set this to say 5, then the processor could potentially get allocated up to 5 threads to process request received by the HandleHTTPRequest processor.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thought here is you might also be seeing service unavailable because the container queue is filling faster then the processor is producing the FlowFiles as another possibility.&lt;BR /&gt;&lt;BR /&gt;Hope this information helps you in your investigation and solution for you issue.&lt;/P&gt;&lt;P&gt;If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on one or more of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 17:40:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384675#M245455</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2024-03-06T17:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi is responding SERVICE_UNAVAILABLE  when api request volume is little high</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384768#M245477</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 10:20:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-is-responding-SERVICE-UNAVAILABLE-when-api-request/m-p/384768#M245477</guid>
      <dc:creator>hegdemahendra</dc:creator>
      <dc:date>2024-03-08T10:20:29Z</dc:date>
    </item>
  </channel>
</rss>

