You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by o haya <oh...@yahoo.com.INVALID> on 2015/11/16 20:55:26 UTC

[users@httpd] Getting "connection refused" Apache 2.4

Hi,

I am trying to do some load testing of Apache 2.4 on Redhat. 

Configuration displayed when I run "httpd -V" shows:

Server MPM: prefork
threaded: no
forked: yes (variable process count)

I am using Jmeter to test, and when I increase the number of simultaneous threads to > 200, I am seeing increasing number of errors, with a lot of "connection refused" errors, e.g.:

org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.3.10:80 refused
	at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
	at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
	at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:107)
	at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
	at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127)
	at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
	... 14 more


I've been trying to re-configure the Apache to avoid these errors, e.g., increasing "MaxClients", and I've also increased the amount of memory for the machine (to 4GB) but so far, nothing I have done has improved the situation.

Is there something else that I can do to try to get the Apache so that it can accept the larger number of connections?

Thanks,
Jim



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting "connection refused" Apache 2.4

Posted by Daniel <df...@gmail.com>.
I always recommend to specify a fixed ServerLimit Value, if you have 500
processes but you allow 150 clients, I think you are just filling a backlog
of connections which are not attended until you get to a limit of
backlogged connections.

Do you have specific errors in apache? Check the server config context
error log first.

Also later if you have correctly configured your mpm for the amount of real
clients you will have,  it is worth a try to check ulimit values "ulimit
-a" for root. Also consider if you start apache using "sudo", your ulimit
values will be used instead of root's.



El mar., 17 nov. 2015 a las 2:10, o haya (<oh...@yahoo.com.invalid>)
escribió:

> This is what is in the extra/httpd-mpm.conf:
>
> # prefork MPM
> # StartServers: number of server processes to start
> # MinSpareServers: minimum number of server processes which are kept spare
> # MaxSpareServers: maximum number of server processes which are kept spare
> # MaxClients: maximum number of server processes allowed to start
> # MaxRequestsPerChild: maximum number of requests a server process serves
> <IfModule mpm_prefork_module>
>     StartServers          5
>     MinSpareServers       5
>     MaxSpareServers      10
>     MaxClients          150
>     MaxRequestsPerChild   0
> </IfModule>
>
>
>
>
> ------------------------------
> *From:* Yann Ylavic <yl...@gmail.com>
>
> *To:* users@httpd.apache.org; o haya <oh...@yahoo.com>
> *Sent:* Monday, November 16, 2015 7:57 PM
>
> *Subject:* Re: [users@httpd] Getting "connection refused" Apache 2.4
>
> On Tue, Nov 17, 2015 at 1:11 AM, Yann Ylavic <yl...@gmail.com> wrote:
>
>
>
> > On Tue, Nov 17, 2015 at 12:23 AM, o haya <oh...@yahoo.com.invalid>
> wrote:
> >>
> >> This is with the as-built Apache configuration settings (i.e., I haven't
> >> tried tweaking them).
> >
> > Please share your settings for [...]
> > MaxSpareThreads, MinSpareThreads [...]
>
>
> I meant MaxSpareServers and MinSpareServers here, *Threads are not
> relevant for prefork.
>
>
>
>

Re: [users@httpd] Getting "connection refused" Apache 2.4

Posted by o haya <oh...@yahoo.com.INVALID>.
This is what is in the extra/httpd-mpm.conf:
# prefork MPM# StartServers: number of server processes to start# MinSpareServers: minimum number of server processes which are kept spare# MaxSpareServers: maximum number of server processes which are kept spare# MaxClients: maximum number of server processes allowed to start# MaxRequestsPerChild: maximum number of requests a server process serves<IfModule mpm_prefork_module>    StartServers          5    MinSpareServers       5    MaxSpareServers      10    MaxClients          150    MaxRequestsPerChild   0</IfModule>



      From: Yann Ylavic <yl...@gmail.com>
 To: users@httpd.apache.org; o haya <oh...@yahoo.com> 
 Sent: Monday, November 16, 2015 7:57 PM
 Subject: Re: [users@httpd] Getting "connection refused" Apache 2.4
   
On Tue, Nov 17, 2015 at 1:11 AM, Yann Ylavic <yl...@gmail.com> wrote:


> On Tue, Nov 17, 2015 at 12:23 AM, o haya <oh...@yahoo.com.invalid> wrote:
>>
>> This is with the as-built Apache configuration settings (i.e., I haven't
>> tried tweaking them).
>
> Please share your settings for [...]
> MaxSpareThreads, MinSpareThreads [...]

I meant MaxSpareServers and MinSpareServers here, *Threads are not
relevant for prefork.


  

Re: [users@httpd] Getting "connection refused" Apache 2.4

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Nov 17, 2015 at 1:11 AM, Yann Ylavic <yl...@gmail.com> wrote:
> On Tue, Nov 17, 2015 at 12:23 AM, o haya <oh...@yahoo.com.invalid> wrote:
>>
>> This is with the as-built Apache configuration settings (i.e., I haven't
>> tried tweaking them).
>
> Please share your settings for [...]
> MaxSpareThreads, MinSpareThreads [...]

I meant MaxSpareServers and MinSpareServers here, *Threads are not
relevant for prefork.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting "connection refused" Apache 2.4

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Nov 17, 2015 at 12:23 AM, o haya <oh...@yahoo.com.invalid> wrote:
>
> This is with the as-built Apache configuration settings (i.e., I haven't
> tried tweaking them).

Please share your settings for ServerLimit, MaxRequestWorkers (was
MaxClients in 2.2.x), MaxSpareThreads, MinSpareThreads and
MaxConnectionsPerChild (was MaxRequestsPerChild in 2.2.x).

These are probably from CentOS if you did not tweek them, and some
tuning may be necessary to fit your needs.

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting "connection refused" Apache 2.4

Posted by o haya <oh...@yahoo.com.INVALID>.
Hi,
Just as a kind of slightly-different sanity check, I did some testing on an Apache 2.2.31 instance that I built awhile ago on one of my test CENTOS machines:
Server version: Apache/2.2.31 (Unix)Server built:   Oct  7 2015 11:32:17Server's Module Magic Number: 20051115:40Server loaded:  APR 1.5.2, APR-Util 1.5.4Compiled using: APR 1.5.2, APR-Util 1.5.4Architecture:   64-bitServer MPM:     Prefork  threaded:     no    forked:     yes (variable process count)Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/apps/httpd" -D SUEXEC_BIN="/apps/httpd/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf"
Then, I ran essentially the same load test that I had been running earlier, and, I get similar errors, e.g., connection refused.
This is with the as-built Apache configuration settings (i.e., I haven't tried tweaking them).
This is kind of leading me to think that it may the Apache, built with the above MPM model, may just not be able to sustain this kind of load error-free? 
Thanks,Jim
      From: o haya <oh...@yahoo.com.INVALID>
 To: "users@httpd.apache.org" <us...@httpd.apache.org> 
Cc: O. Haya <oh...@yahoo.com> 
 Sent: Monday, November 16, 2015 3:44 PM
 Subject: Re: [users@httpd] Getting "connection refused" Apache 2.4
   
Hi Daniel,
Unfortunately, the Apache I'm working with is part of a product, so I won't be able to change to a different MPM type.
I've been trying what you suggested (increasing MinSpareServers) but I still get tons of connections refused, even when I can confirm that, for example, I get 500+ httpd instances at startup (e.g., ps -ef shows 500 instances).  Is it possible that something else (e.g., the Redhat OS itself) is limiting the number of connections?
Thanks,Jim

 

     From: Daniel <df...@gmail.com>
 To: users@httpd.apache.org; o haya <oh...@yahoo.com> 
 Sent: Monday, November 16, 2015 3:07 PM
 Subject: Re: [users@httpd] Getting "connection refused" Apache 2.4
   
migrate to worker or event...if you have to stick with prefork mpm, increase the number of MinSpareServers to a very high number, prefork is very slow spawning new children since it is not threaded, so better spawn most when apache starts.


El lun., 16 nov. 2015 a las 20:58, o haya (<oh...@yahoo.com.invalid>) escribió:

Hi,

I am trying to do some load testing of Apache 2.4 on Redhat.

Configuration displayed when I run "httpd -V" shows:

Server MPM: prefork
threaded: no
forked: yes (variable process count)

I am using Jmeter to test, and when I increase the number of simultaneous threads to > 200, I am seeing increasing number of errors, with a lot of "connection refused" errors, e.g.:

org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.3.10:80 refused
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
        at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
        at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:107)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
        at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
        at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
        ... 14 more


I've been trying to re-configure the Apache to avoid these errors, e.g., increasing "MaxClients", and I've also increased the amount of memory for the machine (to 4GB) but so far, nothing I have done has improved the situation.

Is there something else that I can do to try to get the Apache so that it can accept the larger number of connections?

Thanks,
Jim



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org




   

  

Re: [users@httpd] Getting "connection refused" Apache 2.4

Posted by o haya <oh...@yahoo.com.INVALID>.
Hi Daniel,
Unfortunately, the Apache I'm working with is part of a product, so I won't be able to change to a different MPM type.
I've been trying what you suggested (increasing MinSpareServers) but I still get tons of connections refused, even when I can confirm that, for example, I get 500+ httpd instances at startup (e.g., ps -ef shows 500 instances).  Is it possible that something else (e.g., the Redhat OS itself) is limiting the number of connections?
Thanks,Jim

      From: Daniel <df...@gmail.com>
 To: users@httpd.apache.org; o haya <oh...@yahoo.com> 
 Sent: Monday, November 16, 2015 3:07 PM
 Subject: Re: [users@httpd] Getting "connection refused" Apache 2.4
   
migrate to worker or event...if you have to stick with prefork mpm, increase the number of MinSpareServers to a very high number, prefork is very slow spawning new children since it is not threaded, so better spawn most when apache starts.


El lun., 16 nov. 2015 a las 20:58, o haya (<oh...@yahoo.com.invalid>) escribió:

Hi,

I am trying to do some load testing of Apache 2.4 on Redhat.

Configuration displayed when I run "httpd -V" shows:

Server MPM: prefork
threaded: no
forked: yes (variable process count)

I am using Jmeter to test, and when I increase the number of simultaneous threads to > 200, I am seeing increasing number of errors, with a lot of "connection refused" errors, e.g.:

org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.3.10:80 refused
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
        at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
        at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:107)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
        at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
        at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
        ... 14 more


I've been trying to re-configure the Apache to avoid these errors, e.g., increasing "MaxClients", and I've also increased the amount of memory for the machine (to 4GB) but so far, nothing I have done has improved the situation.

Is there something else that I can do to try to get the Apache so that it can accept the larger number of connections?

Thanks,
Jim



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org




  

Re: [users@httpd] Getting "connection refused" Apache 2.4

Posted by Daniel <df...@gmail.com>.
migrate to worker or event...
if you have to stick with prefork mpm, increase the number of
MinSpareServers to a very high number, prefork is very slow spawning new
children since it is not threaded, so better spawn most when apache starts.

El lun., 16 nov. 2015 a las 20:58, o haya (<oh...@yahoo.com.invalid>)
escribió:

> Hi,
>
> I am trying to do some load testing of Apache 2.4 on Redhat.
>
> Configuration displayed when I run "httpd -V" shows:
>
> Server MPM: prefork
> threaded: no
> forked: yes (variable process count)
>
> I am using Jmeter to test, and when I increase the number of simultaneous
> threads to > 200, I am seeing increasing number of errors, with a lot of
> "connection refused" errors, e.g.:
>
> org.apache.http.conn.HttpHostConnectException: Connection to
> http://10.0.3.10:80 refused
>         at
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
>         at
> org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
>         at
> org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:107)
>         at
> org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
>         at
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
>         at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
>         at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
>         at
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
>         at
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
>         at
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
>         at
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
>         at
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
>         at
> org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
>         at
> org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
>         at java.lang.Thread.run(Unknown Source)
> Caused by: java.net.ConnectException: Connection timed out: connect
>         at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
>         at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
>         at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
>         at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown
> Source)
>         at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
>         at java.net.PlainSocketImpl.connect(Unknown Source)
>         at java.net.SocksSocketImpl.connect(Unknown Source)
>         at java.net.Socket.connect(Unknown Source)
>         at
> org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127)
>         at
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
>         ... 14 more
>
>
> I've been trying to re-configure the Apache to avoid these errors, e.g.,
> increasing "MaxClients", and I've also increased the amount of memory for
> the machine (to 4GB) but so far, nothing I have done has improved the
> situation.
>
> Is there something else that I can do to try to get the Apache so that it
> can accept the larger number of connections?
>
> Thanks,
> Jim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>