logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: ThreadsPerChild and mpm_winnt
Author
apishdad



Joined: 01 Jul 2019
Posts: 44
Location: Canada, Toronto

PostPosted: Fri 29 Jan '21 7:08    Post subject: ThreadsPerChild and mpm_winnt Reply with quote

Is it wise to enable httpd-mpm.conf:
Include conf/extra/httpd-mpm.conf

in the httpd.conf file when you have a server which is acting as a reverse proxy?

Why does Apache by default disable this module in httpd.conf?

I have a situation where Apache is running on a windows 2019 server and it's acting as a reverse proxy using mod_proxy_balancer and distributing the load across 3 other application servers which are serving web pages using JBoss.

suddenly our server started to get a lot of hits and the log file started giving errors indicating that the ThreadsPerChild needs to be increased.

Before that, we had played with KeepAliveTimeout which did not have lasting effects on the situation and soon after the server was restarted we began to see performance degraded.

When we uncommented out httpd-mpm.conf, then suddenly performance went through the roof and the server was able to manage the load.

How do you know when to have this module enabled?
Does this module affect performance in low traffic sites?
Is there a tool that you can use to simulate traffic and tweak the ThreadsPerChild parameter?

Thanks for your help
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Sat 30 Jan '21 17:18    Post subject: Re: ThreadsPerChild and mpm_winnt Reply with quote

apishdad wrote:
When we uncommented out httpd-mpm.conf...

Do you mean comment out (disable), or include (enable) httpd-mpm.conf?

According to the documentation, http://httpd.apache.org/docs/current/mod/mpm_common.html#threadsperchild, the default value of ThreadsPerChild is quoted as 64 for WinNT MPM, whilst in file httpd-mpm.conf this figure gets increased to 150.

The above documentation also says
    Capacity is configured using the ThreadsPerChild directive, which sets the maximum number of concurrent client connections.
so for Apache on Windows, since there's only the one child process creating threads to handle client requests, you clearly need to size ThreadsPerChild accordingly.

You should consider the ThreadLimit directive too, when increasing ThreadsPerChild.

I'd suggest this threads issue is separate to timeout issues discussed in your previous posts.

With regards to load testing, I'd start with Apache Bench (ab) before considering more complex Open Source or commerical benchmarking tools.
Back to top
apishdad



Joined: 01 Jul 2019
Posts: 44
Location: Canada, Toronto

PostPosted: Sun 31 Jan '21 23:20    Post subject: Reply with quote

Thanks again tangent for your reply.
in my original post I meant to enable httpd-mpm.conf

I will look at ThreadLimit directive too. It is not included as part httpd-mpm.conf file, but I saw the description of it in the Apache2.4 documentation.

We pumped up the ThreadsPerChild to some high value about 700, but I dont know whether thats necessary or not. Didnt test it with lower values to see what happens.

Its one of those fear based decisions to get things going.
My question is :

What is the memory consequences for having such a high value.

I am not comfortable with the value myself, but now everything works.

Also I noticed Apache Bench does not work for https, it only works for http.
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Mon 01 Feb '21 0:11    Post subject: Reply with quote

Ok, so the documentation says "the default value for ThreadLimit is 1920 when used with mpm_winnt and 64 when used with the others", so your ThreadsPerChild figure of 700 is well below that limit. The key thing, as mentioned above, is ThreadsPerChild determines the maximum number of concurrent client connections this instance of Apache will accept.

But this figure is only part of your service stack, which surely depends on how many concurrent connections your backend JBoss application servers are sized to accept. Will they cope with 700 concurrent users?

With regards to memory usage on your server, I suggest you start with Process Explorer from Windows Sysinternals, which will show you process performance details for memory, threads, etc.

Re load testing, for HTTPS support with Apache Bench, use abs rather than ab.
Back to top
apishdad



Joined: 01 Jul 2019
Posts: 44
Location: Canada, Toronto

PostPosted: Wed 03 Feb '21 9:55    Post subject: Reply with quote

Thanks tangent for all your help
Back to top
apishdad



Joined: 01 Jul 2019
Posts: 44
Location: Canada, Toronto

PostPosted: Thu 04 Feb '21 15:44    Post subject: Reply with quote

One last question:
Is there a online calculator where you can put the number of processors and amount of memory for your machine and it tells you what is the value you should be using for ThreadsLimit and ThreadsPerChild?
Thanks
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Thu 04 Feb '21 22:16    Post subject: Reply with quote

Sorry, I'm not aware of any online calculator that would help you with this.

There are various guideline documents out there that people have produced over the years, but each system and solution is different, as is the hardware on which it runs. Indeed, most performance tuning guides refer to MPM Worker or MPM Event, and not MPM WinNT to which you're constrained on a Windows host.

Your simple starting point is the number of concurrent user connections you need to support, and for MPM WinNT that determines your thread count. Threads will be shared across as many CPU cores as you have, and memory is best sized as part of performance benchmarking for a known number of user connections, and then scaling to the maximum. Unless you're planning to support many 1000's of concurrent connections, you probably won't have worry about network tuning.

But as mentioned before, this all ties in to the quality of service and availability you're required to provide. Are you using just the one Apache server to host the service frontend, i.e. no load balancer's above Apache for scaling and resilience? What happens when your server goes offline during patching, upgrades, etc.

There's a lot to think about, most of which can be resolved under the heading of wisdom and experience.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 09 Feb '21 20:46    Post subject: Reply with quote

apishdad wrote:
One last question:
Is there a online calculator where you can put the number of processors and amount of memory for your machine and it tells you what is the value you should be using for ThreadsLimit and ThreadsPerChild?
Thanks


You may also take a look at MaxConnectionsPerChild[1]


Threadlimit and and ThreadsPerChild should be the same see[2] For Windows the default ThreadLimit is 64. ThreadsPerChild is 25 default on Windows.

Did you already set this?

Code:

AcceptFilter http none
AcceptFilter https none



[1] https://httpd.apache.org/docs/2.4/en/mod/mpm_common.html#maxconnectionsperchild
[2]https://httpd.apache.org/docs/2.4/en/mod/mpm_common.html#threadlimit
Back to top
apishdad



Joined: 01 Jul 2019
Posts: 44
Location: Canada, Toronto

PostPosted: Sun 18 Apr '21 17:45    Post subject: Reply with quote

Hi James Blond,
Sorry to respond late to this post, but I was checking the documentation

https://httpd.apache.org/docs/2.4/mod/core.html#acceptfilter

on AcceptFilter and couldn't find exactly why I would put

AcceptFilter https none
AcceptFilter http none

In here. The Apache documentation on this says :

>>>>>>>>>>>


Window's mpm_winnt interprets the AcceptFilter to toggle the AcceptEx() API, and does not support http protocol buffering. connect will use the AcceptEx() API, also retrieve the network endpoint addresses, but like none the connect option does not wait for the initial data transmission.

On Windows, none uses accept() rather than AcceptEx() and will not recycle sockets between connections. This is useful for network adapters with broken driver support, as well as some virtual network providers such as vpn drivers, or spam, virus or spyware filters.

<<<<<<<<<<<<<<<<


In one other post in this forum

https://www.apachelounge.com/viewtopic.php?t=4461

it is recommended that you comment this statement and not use it

I have 2 questions

1. Should I use Acceptfilter https none
I only allow https traffic on the servers , no http

2. If I use AcceptFilter https none, do you think it will interfere with the segregation of cookies that was recommended to me by tangent in the following post:
https://www.apachelounge.com/viewtopic.php?p=39945#39945

Thanks for your help
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 22 Apr '21 21:07    Post subject: Reply with quote

apishdad wrote:

AcceptFilter https none
AcceptFilter http none


Anywhere in your httpd.conf file
I have 2 questions

apishdad wrote:

1. Should I use Acceptfilter https none
I only allow https traffic on the servers , no http


If encounter any problems with that in your error logs. Otherwise don't. Apachelounge on the other hand has it enabled and this site as no side effects with it.

apishdad wrote:

2. If I use AcceptFilter https none, do you think it will interfere with the segregation of cookies that was recommended to me by tangent in the following post:
https://www.apachelounge.com/viewtopic.php?p=39945#39945

Thanks for your help


I have those settings enabled and did not encounter that yet, I don't run JBoss anywhere.
Back to top
apishdad



Joined: 01 Jul 2019
Posts: 44
Location: Canada, Toronto

PostPosted: Fri 23 Apr '21 8:42    Post subject: Reply with quote

Thanks, James Blond for your help
Back to top


Reply to topic   Topic: ThreadsPerChild and mpm_winnt View previous topic :: View next topic
Post new topic   Forum Index -> Apache