Re: [users@httpd] Apache closes the connection after receiving a request.

2015-11-03 Thread Novi Jinx
Hi Yann,

Many thanks for the prompt response.

I believe it does not relate to KeepAliveTimeout. We are using the default 
value (KeepAliveTimeout = 5s); the time span between the successful request 
(which has a proper response) and the subsequent failed request (which has ACK 
but the connection got disconnected after that) varies from 1s to 11s. We did 
increase KeepAliveTimeout to 35s but the problems still persisted.

Talking about KeepAliveTimeout, I expect that if the time is expired, the sever 
will force the client to open new TCP connection not accepting the request then 
closing the connection right after that. Am I wrong ?

Thanks,

---


On Tuesday, 3 November 2015, 23:13, Yann Ylavic  wrote:
On Tue, Nov 3, 2015 at 12:47 PM, Novi Jinx  wrote:

>
> Recently I have experienced a behaviour of Apache on my PROD environment that 
> I could not explain. My Apache decided to close a TCP connection right after 
> successfully receiving a request (sent ACK back to a client). With the 
> KeepAlive is On, there were several successful requests & responses in the 
> same TCP connection before this happens. The disconnection usually happened 
> around the request 7th or 8th.

How long between the previous request and the one for which the
connection is (early) closed?
Is that time related to the KeepAliveTimeout configuration?

Regards,
Yann.

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

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



Re: [users@httpd] prefork vs worker mpm in apache

2015-11-03 Thread Rose, John B
On 11/3/15 2:21 PM, "Jim Jagielski"  wrote:

>
>> On Nov 3, 2015, at 10:43 AM, Tim Dunphy  wrote:
>> 
>> 
>> Hey guys,
>> 
>> We had to recompile apache 2.4.12 because we needed to disable thread
>>safety in php (ZTS).  Because for some reason when compiling php with
>>the --disable-maintainer-zts with the worker mpm model and checking the
>>php info page, it was saying that thread safety was still enabled.
>> 
>> So when we recompiled apache to use the prefetch worker model instead
>>of worker, the php info page was showing that  thread safety was
>>disabled.
>> 
>> But after that change apache processes spiked from around 11 processes
>>per machine to well over 250 processes at any given time.
>> 

Does "Prefetch worker" = Event MPM? I thought "Event" with PHP-FPM was the
suggested config.

>> These are the tuning settings we have in apache:
>> 
>> StartServers 10
>> 
>> #MinSpareServers 10
>> 
>> #MaxSpareServers 25
>> 
>> ServerLimit 250
>> 
>> MaxRequestWorkers 250
>> 
>> MaxConnectionsPerChild 1000
>
>Should be 0.

What "Should be 0"?


>
>> 
>> KeepAlive On
>> 
>> KeepAliveTimeout 30

Seems like I have read in somewhat recent exchanges that "KeepAlive Off"
is the recognized preference?

>
>Should be 3 or so
>
>> 
>> EnableSendfile Off
>
>Should be On
>
>
>Cheers!
>-
>To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
>For additional commands, e-mail: users-h...@httpd.apache.org


Thanks


>


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



Re: [users@httpd] prefork vs worker mpm in apache

2015-11-03 Thread Jim Jagielski

> On Nov 3, 2015, at 10:43 AM, Tim Dunphy  wrote:
> 
> 
> Hey guys,
> 
> We had to recompile apache 2.4.12 because we needed to disable thread safety 
> in php (ZTS).  Because for some reason when compiling php with the 
> --disable-maintainer-zts with the worker mpm model and checking the php info 
> page, it was saying that thread safety was still enabled.
> 
> So when we recompiled apache to use the prefetch worker model instead of 
> worker, the php info page was showing that  thread safety was disabled.
> 
> But after that change apache processes spiked from around 11 processes per 
> machine to well over 250 processes at any given time.
> 
> These are the tuning settings we have in apache:
> 
> StartServers 10
> 
> #MinSpareServers 10
> 
> #MaxSpareServers 25
> 
> ServerLimit 250
> 
> MaxRequestWorkers 250
> 
> MaxConnectionsPerChild 1000

Should be 0.

> 
> KeepAlive On
> 
> KeepAliveTimeout 30

Should be 3 or so

> 
> EnableSendfile Off

Should be On


Cheers!
-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] prefork vs worker mpm in apache

2015-11-03 Thread Tom Evans
On Tue, Nov 3, 2015 at 3:43 PM, Tim Dunphy  wrote:
>
> Hey guys,
>
> We had to recompile apache 2.4.12 because we needed to disable thread safety
> in php (ZTS).  Because for some reason when compiling php with the
> --disable-maintainer-zts with the worker mpm model and checking the php info
> page, it was saying that thread safety was still enabled.

This is unsurprising. If you use a threaded process manager in apache,
you will need thread safety in anything embedded in to apache.

>
> So when we recompiled apache to use the prefetch worker model instead of
> worker, the php info page was showing that  thread safety was disabled.
>
> But after that change apache processes spiked from around 11 processes per
> machine to well over 250 processes at any given time.


*Prefork* will fork one process for each concurrent request you
handle. So if you have ServerLimit 250, and 250 concurrent requests,
you will need enough RAM/CPU to handle 250 processes.

This is why it prefork is avoided, it is very expensive for high volume sites.

>
> These are the tuning settings we have in apache:
>
> StartServers 10
>
> #MinSpareServers 10
>
> #MaxSpareServers 25
>
> ServerLimit 250
>
> MaxRequestWorkers 250
>
> MaxConnectionsPerChild 1000
>
> KeepAlive On
>
> KeepAliveTimeout 30
>
> EnableSendfile Off
>
>
> So I was just wondering how this change could've cause this problem of
> having the number of apache processes spike. And if there are any other
> changes we can make to apache to bring the process count down?

This is all explained in the docs for each of those directives. With
prefork, to handle 250 clients will require 250 processes. With
worker, it will start 25 worker threads per process (ThreadsPerChild),
so to handle 250 clients requires only 10 processes.

I would recommend to detach PHP from Apache, and run them
independently, using fastcgi and PHP-FPM.

Cheers

Tom

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



[users@httpd] prefork vs worker mpm in apache

2015-11-03 Thread Tim Dunphy
Hey guys,

We had to recompile apache 2.4.12 because we needed to disable thread
safety in php (ZTS).  Because for some reason when compiling php with the
--disable-maintainer-zts with the worker mpm model and checking the php
info page, it was saying that thread safety was still enabled.

So when we recompiled apache to use the prefetch worker model instead of
worker, the php info page was showing that  thread safety was disabled.

But after that change apache processes spiked from around 11 processes per
machine to well over 250 processes at any given time.

These are the tuning settings we have in apache:

StartServers 10

#MinSpareServers 10

#MaxSpareServers 25

ServerLimit 250

MaxRequestWorkers 250

MaxConnectionsPerChild 1000

KeepAlive On

KeepAliveTimeout 30

EnableSendfile Off


So I was just wondering how this change could've cause this problem of
having the number of apache processes spike. And if there are any other
changes we can make to apache to bring the process count down?

Also I realize that installing apache / php from source isn't standard
practice on red hat variants. But at the time that these servers were setup
the latest apache at that time (2.4.12) wasn't available as an RPM. So we
just decided to install from source.

Thanks
-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B


Re: [users@httpd] Apache closes the connection after receiving a request.

2015-11-03 Thread Yann Ylavic
On Tue, Nov 3, 2015 at 12:47 PM, Novi Jinx  wrote:
>
> Recently I have experienced a behaviour of Apache on my PROD environment that 
> I could not explain. My Apache decided to close a TCP connection right after 
> successfully receiving a request (sent ACK back to a client). With the 
> KeepAlive is On, there were several successful requests & responses in the 
> same TCP connection before this happens. The disconnection usually happened 
> around the request 7th or 8th.

How long between the previous request and the one for which the
connection is (early) closed?
Is that time related to the KeepAliveTimeout configuration?

Regards,
Yann.

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



[users@httpd] Apache closes the connection after receiving a request.

2015-11-03 Thread Novi Jinx
Hi,

This is the first time I send to the mail list so please forgive me if I do 
something wrong/ improperly.

Recently I have experienced a behaviour of Apache on my PROD environment that I 
could not explain. My Apache decided to close a TCP connection right after 
successfully receiving a request (sent ACK back to a client). With the 
KeepAlive is On, there were several successful requests & responses in the same 
TCP connection before this happens. The disconnection usually happened around 
the request 7th or 8th.

Please find attached the screen-shot of the network when the disconnection 
happened. 

The environment is
Ubuntu 14.04.3 LTS
Server version: Apache/2.4.7 (Ubuntu) / Oct 14 2015

The apache2 configuration is out of the box.

Any suggestions / hits are really appreciated.

Many thanks,

P/S: I also created an issue on ServerFault but without any luck
http://serverfault.com/questions/732189/apache2-send-fin-ack-immediately
-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

[users@httpd] Cannot find request by error log id

2015-11-03 Thread Виталий Фадеев
Hi!

I modify access and error log formats by add %L parameter.

In my error log i get this:
[Tue Nov 03 02:55:33.635958 2015] [VjiEkn8AAAEAAHuBfzkAAABB] [-:error]
[pid 31617:tid [client IP:PORT] PHP Warning:
unlink(/tmp/file_name.txt): No such file or directory in
/var/www/file_test.php on line 1, referer REFERER

If i try to find this ID in access logs - nothing found.

If i search request by referer, pid, ip and port combination - there
is also no ID

Why? Is this some limitations?

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



[users@httpd] RewriteMap overlap with ProxyPass

2015-11-03 Thread Mathijs Schmittmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hi all,

I have the following configuration on a 2.2.x installation:


ProxyPass /foo ajp://10.20.30.40/bla
RewriteMap bar txt:/var/www/html/map.txt
RewriteCond ${bar:$1} >""
RewriteRule ^/(.*)$ ${bar:$1}


Now in the map.txt file there is content like this:
bla/ target/bla.html
foo/ target/foo.html

The second line in the rewritemap file will never be processed it
seems, because requests to /foo are 'intercepted' by the ProxyPass
before any rewrite actions are applied.

Is there any way to make the rewritemap precede the proxypass directive?

Best regards,
Mathijs Schmittmann
-BEGIN PGP SIGNATURE-
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJWOIAZAAoJEHU+9B0GxpC8/dsP/160AFslOqMB5Q4ZfYtl6iUl
gNtahOEHSl40BA3VAlQ2cH4mUNkgcga77JPjB7j6PIhL9rIETnaXikKC3QDz95ml
qRUB12TVu6EvKQHWVHYVv5P8wHq8RWW1RfpPwiV6P0d01dcKn1P0BtkNpwhhSa8h
j6NGO9sbsLwCpzdM9Gxj6ZxgHoAya/EFSforZ92haopGn2WtdOWw0sUyP3P8/l7d
BN58kP8cy+X87tsS1aPCcNpV/lA6yJTm/gnLA02Gx7IDkUXzSsLm/CUfzxGe1RyS
B6+iz80mFvzNBJhA/viUBBKENAW7dRJ92ZV4id61sST7AFeiTKyBgIFtSw6JmbPp
B00K9nZd3MTwzjbgP+hL8TeLHE2qRG113ZZ+zLrdT7YbGE1LxFYQ3a2oB1YdH8wt
lBu1lVKqr2UQbnH/6ttXl403teklZiQWvh3JjTyu78jswuG1NrmTKu2YkO6sU7Cj
gJHT/diXlDvMZhUF++INj9YmWaTyaLVbCJ32lff6D3VHyFMDVEb8YJiRWmDJAkls
Gdky+fP5UxQqPxfW9XQZ84fVQTKwCytvLH5bY20ZI5nUEFku4oQo/HshCtPNmIfK
KH5uhj/2ZEZrEvAe+Ed+8TaCARUKOWJ2A5SWPd01HVqM2ZRGtdwM+m39hFG0Ji4O
P40gWGkuF+tn2Au+OQ4k
=O7J2
-END PGP SIGNATURE-

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