Service Engine - Thread pool

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Service Engine - Thread pool

pratyush Giri
Hi All,

I researched the topic and could not find answers and hence the question. If I was not able to figure out the appropriate search query, my aplogies.

I am trying to increase the thread count for the service engine (min - 20, max: 200). Currently, I am exploring and would like to find the optimum for my use-case (that's on me).

From the documentation, I modified the service engine xml as follows:

<thread-pool send-to-pool="pool"
                     purge-job-days="4"
                     failed-retry-min="3"
                     ttl="120000"
                     jobs="300"
                     min-threads="20"
                     max-threads="200"
                     poll-enabled="true"
                     poll-db-millis="30000">
            <run-from-pool name="pool"/>
        </thread-pool>

However, on my restart of the server, the link thread list shows still as a min. of 2 and a max of 5 threads.

https://localhost:8443/webtools/control/threadList

Keep Alive Time In Seconds 120
Number Of Core Invoker Threads 2
Current Number Of Invoker Threads 2
Number Of Active Invoker Threads 0
Max Number Of Invoker Threads 5
Greatest Number Of Invoker Threads 2
Number Of Completed Tasks 32

Question: Why are the serviceengine.xml settings are not honored? Did I miss something else?

On a side note, with the same settings, i.e. min of 2 and max of 5 threads, when I hit about 100 concurrent requests to create order:  org.apache.ofbiz.order.shoppingcart.CheckOutHelper.createOrder method gets exponentially delayed sometimes talking around 3 minutes to complete and sometimes timing out. That is the reason for my exploration. My system is backed by a Postgres database.

Thank you all in advance.

Best,
Pratyush








Reply | Threaded
Open this post in threaded view
|

Re: Service Engine - Thread pool

Nicolas Malin-2
Hello Pratyush,

I have this configuration that works fine

<thread-pool send-to-pool="pool"
purge-job-days="4"
failed-retry-min="30"
ttl="120000"
jobs="100"
min-threads="4"
max-threads="7"
poll-enabled="true"
poll-db-millis="30000">
<run-from-pool name="pool"/>
</thread-pool>


But not sure that your on the good way to solve your problem. This configuration is for the job manager and not increase the threading on your server for main OFBiz thread.
I suggest you to check your jvm values, database activity for improve indexes, or analyze secas or eecas not useful for your process to increase your velocity

Cheers,
Nicolas

On 08/03/2021 22:18, pratyush Giri wrote:

> Hi All,
>
> I researched the topic and could not find answers and hence the question. If I was not able to figure out the appropriate search query, my aplogies.
>
> I am trying to increase the thread count for the service engine (min - 20, max: 200). Currently, I am exploring and would like to find the optimum for my use-case (that's on me).
>
> >From the documentation, I modified the service engine xml as follows:
>
> <thread-pool send-to-pool="pool"
>                      purge-job-days="4"
>                      failed-retry-min="3"
>                      ttl="120000"
>                      jobs="300"
>                      min-threads="20"
>                      max-threads="200"
>                      poll-enabled="true"
>                      poll-db-millis="30000">
>             <run-from-pool name="pool"/>
>         </thread-pool>
>
> However, on my restart of the server, the link thread list shows still as a min. of 2 and a max of 5 threads.
>
> https://localhost:8443/webtools/control/threadList
>
> Keep Alive Time In Seconds 120
> Number Of Core Invoker Threads 2
> Current Number Of Invoker Threads 2
> Number Of Active Invoker Threads 0
> Max Number Of Invoker Threads 5
> Greatest Number Of Invoker Threads 2
> Number Of Completed Tasks 32
>
> Question: Why are the serviceengine.xml settings are not honored? Did I miss something else?
>
> On a side note, with the same settings, i.e. min of 2 and max of 5 threads, when I hit about 100 concurrent requests to create order:  org.apache.ofbiz.order.shoppingcart.CheckOutHelper.createOrder method gets exponentially delayed sometimes talking around 3 minutes to complete and sometimes timing out. That is the reason for my exploration. My system is backed by a Postgres database.
>
> Thank you all in advance.
>
> Best,
> Pratyush
>
>
>
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Service Engine - Thread pool

pratyush Giri
Thank you Nicolas. I appreciate the response.

When you say the configuration works fine, what do you mean? Do you see 4
threads getting created ( I think not as you suggested that this
configuration is not for the Ofbiz main thread)? Have you tested bombarding
the system with many concurrent order requests? How many concurrent orders
we can create with 1 Ofbiz node ( I am hoping I can scale horizontally by
adding more nodes to the cluster).

While I agree and am looking at the other things you mentioned, I feel
there may be a way to increase the thread count of the main Ofbiz
application. Is there one?

Are there any production level configurations (best practices) around
threads and memory?

Best,
Pratyush



On Tue, Mar 9, 2021 at 12:26 AM Nicolas Malin <[hidden email]>
wrote:

> Hello Pratyush,
>
> I have this configuration that works fine
>
>         <thread-pool send-to-pool="pool"                     purge-job-days="4"                     failed-retry-min="30"                     ttl="120000"                     jobs="100"                     min-threads="4"                     max-threads="7"                     poll-enabled="true"                     poll-db-millis="30000">            <run-from-pool name="pool"/>        </thread-pool>
>
> But not sure that your on the good way to solve your problem. This configuration is for the job manager and not increase the threading on your server for main OFBiz thread.
> I suggest you to check your jvm values, database activity for improve indexes, or analyze secas or eecas not useful for your process to increase your velocity
>
> Cheers,
> Nicolas
>
>
> On 08/03/2021 22:18, pratyush Giri wrote:
>
> Hi All,
>
> I researched the topic and could not find answers and hence the question. If I was not able to figure out the appropriate search query, my aplogies.
>
> I am trying to increase the thread count for the service engine (min - 20, max: 200). Currently, I am exploring and would like to find the optimum for my use-case (that's on me).
>
> >From the documentation, I modified the service engine xml as follows:
>
> <thread-pool send-to-pool="pool"
>                      purge-job-days="4"
>                      failed-retry-min="3"
>                      ttl="120000"
>                      jobs="300"
>                      min-threads="20"
>                      max-threads="200"
>                      poll-enabled="true"
>                      poll-db-millis="30000">
>             <run-from-pool name="pool"/>
>         </thread-pool>
>
> However, on my restart of the server, the link thread list shows still as a min. of 2 and a max of 5 threads.
> https://localhost:8443/webtools/control/threadList
>
> Keep Alive Time In Seconds 120
> Number Of Core Invoker Threads 2
> Current Number Of Invoker Threads 2
> Number Of Active Invoker Threads 0
> Max Number Of Invoker Threads 5
> Greatest Number Of Invoker Threads 2
> Number Of Completed Tasks 32
>
> Question: Why are the serviceengine.xml settings are not honored? Did I miss something else?
>
> On a side note, with the same settings, i.e. min of 2 and max of 5 threads, when I hit about 100 concurrent requests to create order:  org.apache.ofbiz.order.shoppingcart.CheckOutHelper.createOrder method gets exponentially delayed sometimes talking around 3 minutes to complete and sometimes timing out. That is the reason for my exploration. My system is backed by a Postgres database.
>
> Thank you all in advance.
>
> Best,
> Pratyush
>
>
>
>
>
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Service Engine - Thread pool

Nicolas Malin-2

On 09/03/2021 19:31, pratyush Giri wrote:
> Thank you Nicolas. I appreciate the response.
>
> When you say the configuration works fine, what do you mean? Do you see 4
> threads getting created ( I think not as you suggested that this
> configuration is not for the Ofbiz main thread)?

My service engine return me :

Job Queue Service Threads

Keep Alive Time In Seconds 120
Number Of Core Invoker Threads 4
Current Number Of Invoker Threads 4
Number Of Active Invoker Threads 0
Max Number Of Invoker Threads 7
Greatest Number Of Invoker Threads 4
Number Of Completed Tasks 99


>  Have you tested bombarding
> the system with many concurrent order requests? How many concurrent orders
> we can create with 1 Ofbiz node ( I am hoping I can scale horizontally by
> adding more nodes to the cluster).

Currently we create ~2000 order/day with some peak to ~5000 order/day
distributed on 2 nodes.

The jvm have 4GB allocate and the OFBiz is tuned for the performance
(low log, high cache, disable all audit and tracking)

> While I agree and am looking at the other things you mentioned, I feel
> there may be a way to increase the thread count of the main Ofbiz
> application. Is there one?
OFBiz manage himself the number of thread needed to response, just
ensure that you have enough resource for them (CPU and Memory)
>
> Are there any production level configurations (best practices) around
> threads and memory?

Have you check this faq ?
https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQTipsTricksCookbookHowTo-Audit

For summarize : Enable your cache, configure your log level, synchronize
your entity engine configuration with your database, allow enough
resource for your JVM

Nicolas

>
> Best,
> Pratyush
>
>
>
> On Tue, Mar 9, 2021 at 12:26 AM Nicolas Malin <[hidden email]>
> wrote:
>
>> Hello Pratyush,
>>
>> I have this configuration that works fine
>>
>>         <thread-pool send-to-pool="pool"                     purge-job-days="4"                     failed-retry-min="30"                     ttl="120000"                     jobs="100"                     min-threads="4"                     max-threads="7"                     poll-enabled="true"                     poll-db-millis="30000">            <run-from-pool name="pool"/>        </thread-pool>
>>
>> But not sure that your on the good way to solve your problem. This configuration is for the job manager and not increase the threading on your server for main OFBiz thread.
>> I suggest you to check your jvm values, database activity for improve indexes, or analyze secas or eecas not useful for your process to increase your velocity
>>
>> Cheers,
>> Nicolas
>>
>>
>> On 08/03/2021 22:18, pratyush Giri wrote:
>>
>> Hi All,
>>
>> I researched the topic and could not find answers and hence the question. If I was not able to figure out the appropriate search query, my aplogies.
>>
>> I am trying to increase the thread count for the service engine (min - 20, max: 200). Currently, I am exploring and would like to find the optimum for my use-case (that's on me).
>>
>> >From the documentation, I modified the service engine xml as follows:
>>
>> <thread-pool send-to-pool="pool"
>>                      purge-job-days="4"
>>                      failed-retry-min="3"
>>                      ttl="120000"
>>                      jobs="300"
>>                      min-threads="20"
>>                      max-threads="200"
>>                      poll-enabled="true"
>>                      poll-db-millis="30000">
>>             <run-from-pool name="pool"/>
>>         </thread-pool>
>>
>> However, on my restart of the server, the link thread list shows still as a min. of 2 and a max of 5 threads.
>> https://localhost:8443/webtools/control/threadList
>>
>> Keep Alive Time In Seconds 120
>> Number Of Core Invoker Threads 2
>> Current Number Of Invoker Threads 2
>> Number Of Active Invoker Threads 0
>> Max Number Of Invoker Threads 5
>> Greatest Number Of Invoker Threads 2
>> Number Of Completed Tasks 32
>>
>> Question: Why are the serviceengine.xml settings are not honored? Did I miss something else?
>>
>> On a side note, with the same settings, i.e. min of 2 and max of 5 threads, when I hit about 100 concurrent requests to create order:  org.apache.ofbiz.order.shoppingcart.CheckOutHelper.createOrder method gets exponentially delayed sometimes talking around 3 minutes to complete and sometimes timing out. That is the reason for my exploration. My system is backed by a Postgres database.
>>
>> Thank you all in advance.
>>
>> Best,
>> Pratyush
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>