Re: [users@httpd] Bug in mod_proxy_balancer or just a bad configuration?

2021-06-15 Thread Nick Folino
So I changed the config to eliminate the order question:


Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
env=BALANCER_ROUTE_CHANGED
BalancerMember http://www.google.com route=01
BalancerMember http://www.yahoo.com route=02
ProxySet stickysession=RZROUTEID


Header add Set-Cookie "RZ2ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
env=BALANCER_ROUTE_CHANGED
BalancerMember http://www.fox.com  route=03
BalancerMember http://www.cnn.com  route=04
ProxySet stickysession=RZ2ROUTEID


ProxyPass "/goog"  "balancer://rz/"
ProxyPassReverse "/goog"  "balancer://rz/"
ProxyPass "/good"  "balancer://rz2/"
ProxyPassReverse "/good"  "balancer://rz2/"

going to http://myserver/goog redirects to the Google page and a
set-cookie RZROUTEID=.01
going to http://myserver/good redirects to Fox and a
set-cookie RZ2ROUTEID=.03 and a second set-cookie for RZROUTEID=.03

going back to http://myserver/goog redirects to Yahoo and dets a set-cookie
RZROUTEID=.02

Nick

On Tue, Jun 15, 2021 at 7:57 PM Nick Folino  wrote:

> I thought that too, but if the rz proxypass was catching all traffic for
> rz2, then I wouldn't expect any traffic to get to rz2.
> But traffic does go to rz2 and all of that works, except it resets the rz
> route cookie.
>
> On Tue, Jun 15, 2021 at 3:27 PM Daniel Ferradal 
> wrote:
>
>> If I am looking at it correctly the order of the ProxyPass directives you
>> defined is not the correct one, /sz defined first would be overriding /sz2.
>> So sz2 should be defined first.
>>
>> Perhaps that's why you are getting wrong values ? (Browser cache or
>> similar?)
>>
>> El mar., 15 jun. 2021 19:00, Nick Folino  escribió:
>>
>>> I ran into an interesting situation with cookies being reset
>>> in balancers.
>>> I couldn't find any documentation on whether numbers are allowed in
>>> balancer names.
>>>
>>> I have this config:
>>>
>>>
>>>   Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e;
>>> path=/" env=BALANCER_ROUTE_CHANGED
>>>   BalancerMember ajp://server1 route=01
>>>   BalancerMember ajp://server2 route=02
>>>   ProxySet stickysession=RZROUTEID
>>>
>>>
>>>
>>>   Header add Set-Cookie "RZ2ROUTEID=.%{BALANCER_WORKER_ROUTE}e;
>>> path=/" env=BALANCER_ROUTE_CHANGED
>>>   BalancerMember ajp://server3 route=03
>>>   BalancerMember ajp://server4 route=04
>>>   ProxySet stickysession=RZ2ROUTEID
>>>
>>>
>>> ProxyPass /rz balancer://rz/rz
>>> ProxyPass /rz2 balancer://rz2/rz2
>>>
>>>
>>> All works as expected when going to http://myhost/rz
>>> I get the RZROUTEID cookie set to 01 or 02 on first hit and it stays set.
>>>
>>> If I then go to http://myhost/rz2 I get the RZ2ROUTEID set to 03 or 04
>>> but also another cookie set for RZROUTE with the same value as the
>>> RZ2ROUTEID cookie.
>>>
>>> This causes an issue when going back to /rz as the RZROUTEID cookie is
>>> now invalid and gets reset based on the balancing rules.
>>>
>>> I solved the problem by renaming the rz2 balancer to a new name with a
>>> digit.
>>> Is this by design that digits cause problems in balancer names?  or is
>>> this a bug?
>>>
>>> Nick
>>>
>>>


Re: [users@httpd] Bug in mod_proxy_balancer or just a bad configuration?

2021-06-15 Thread Nick Folino
I thought that too, but if the rz proxypass was catching all traffic for
rz2, then I wouldn't expect any traffic to get to rz2.
But traffic does go to rz2 and all of that works, except it resets the rz
route cookie.

On Tue, Jun 15, 2021 at 3:27 PM Daniel Ferradal 
wrote:

> If I am looking at it correctly the order of the ProxyPass directives you
> defined is not the correct one, /sz defined first would be overriding /sz2.
> So sz2 should be defined first.
>
> Perhaps that's why you are getting wrong values ? (Browser cache or
> similar?)
>
> El mar., 15 jun. 2021 19:00, Nick Folino  escribió:
>
>> I ran into an interesting situation with cookies being reset in balancers.
>> I couldn't find any documentation on whether numbers are allowed in
>> balancer names.
>>
>> I have this config:
>>
>>
>>   Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e;
>> path=/" env=BALANCER_ROUTE_CHANGED
>>   BalancerMember ajp://server1 route=01
>>   BalancerMember ajp://server2 route=02
>>   ProxySet stickysession=RZROUTEID
>>
>>
>>
>>   Header add Set-Cookie "RZ2ROUTEID=.%{BALANCER_WORKER_ROUTE}e;
>> path=/" env=BALANCER_ROUTE_CHANGED
>>   BalancerMember ajp://server3 route=03
>>   BalancerMember ajp://server4 route=04
>>   ProxySet stickysession=RZ2ROUTEID
>>
>>
>> ProxyPass /rz balancer://rz/rz
>> ProxyPass /rz2 balancer://rz2/rz2
>>
>>
>> All works as expected when going to http://myhost/rz
>> I get the RZROUTEID cookie set to 01 or 02 on first hit and it stays set.
>>
>> If I then go to http://myhost/rz2 I get the RZ2ROUTEID set to 03 or 04
>> but also another cookie set for RZROUTE with the same value as the
>> RZ2ROUTEID cookie.
>>
>> This causes an issue when going back to /rz as the RZROUTEID cookie is
>> now invalid and gets reset based on the balancing rules.
>>
>> I solved the problem by renaming the rz2 balancer to a new name with a
>> digit.
>> Is this by design that digits cause problems in balancer names?  or is
>> this a bug?
>>
>> Nick
>>
>>


Re: [users@httpd] Bug in mod_proxy_balancer or just a bad configuration?

2021-06-15 Thread Daniel Ferradal
If I am looking at it correctly the order of the ProxyPass directives you
defined is not the correct one, /sz defined first would be overriding /sz2.
So sz2 should be defined first.

Perhaps that's why you are getting wrong values ? (Browser cache or
similar?)

El mar., 15 jun. 2021 19:00, Nick Folino  escribió:

> I ran into an interesting situation with cookies being reset in balancers.
> I couldn't find any documentation on whether numbers are allowed in
> balancer names.
>
> I have this config:
>
>
>   Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
> env=BALANCER_ROUTE_CHANGED
>   BalancerMember ajp://server1 route=01
>   BalancerMember ajp://server2 route=02
>   ProxySet stickysession=RZROUTEID
>
>
>
>   Header add Set-Cookie "RZ2ROUTEID=.%{BALANCER_WORKER_ROUTE}e;
> path=/" env=BALANCER_ROUTE_CHANGED
>   BalancerMember ajp://server3 route=03
>   BalancerMember ajp://server4 route=04
>   ProxySet stickysession=RZ2ROUTEID
>
>
> ProxyPass /rz balancer://rz/rz
> ProxyPass /rz2 balancer://rz2/rz2
>
>
> All works as expected when going to http://myhost/rz
> I get the RZROUTEID cookie set to 01 or 02 on first hit and it stays set.
>
> If I then go to http://myhost/rz2 I get the RZ2ROUTEID set to 03 or 04
> but also another cookie set for RZROUTE with the same value as the
> RZ2ROUTEID cookie.
>
> This causes an issue when going back to /rz as the RZROUTEID cookie is now
> invalid and gets reset based on the balancing rules.
>
> I solved the problem by renaming the rz2 balancer to a new name with a
> digit.
> Is this by design that digits cause problems in balancer names?  or is
> this a bug?
>
> Nick
>
>


[users@httpd] Bug in mod_proxy_balancer or just a bad configuration?

2021-06-15 Thread Nick Folino
I ran into an interesting situation with cookies being reset in balancers.
I couldn't find any documentation on whether numbers are allowed in
balancer names.

I have this config:

   
  Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
env=BALANCER_ROUTE_CHANGED
  BalancerMember ajp://server1 route=01
  BalancerMember ajp://server2 route=02
  ProxySet stickysession=RZROUTEID
   

   
  Header add Set-Cookie "RZ2ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
env=BALANCER_ROUTE_CHANGED
  BalancerMember ajp://server3 route=03
  BalancerMember ajp://server4 route=04
  ProxySet stickysession=RZ2ROUTEID
   

ProxyPass /rz balancer://rz/rz
ProxyPass /rz2 balancer://rz2/rz2


All works as expected when going to http://myhost/rz
I get the RZROUTEID cookie set to 01 or 02 on first hit and it stays set.

If I then go to http://myhost/rz2 I get the RZ2ROUTEID set to 03 or 04 but
also another cookie set for RZROUTE with the same value as the RZ2ROUTEID
cookie.

This causes an issue when going back to /rz as the RZROUTEID cookie is now
invalid and gets reset based on the balancing rules.

I solved the problem by renaming the rz2 balancer to a new name with a
digit.
Is this by design that digits cause problems in balancer names?  or is this
a bug?

Nick


Re: [users@httpd] Improve memory use [EXT]

2021-06-15 Thread Marc Serra
Thank's James,

99% of the hosted content is static. I think it's time to migrate to MPM
event.

Thank's again.

Missatge de James Smith  del dia dl., 14 de juny 2021 a
les 11:21:

> Yes the answer is almost certainly to do with the number of domains/size
> of code – even if all the sites are running the same code – they are likely
> to have different copies of it (unless they are all running the exact same
> copy of the code – and using a name based switch somewhere in it) There may
> be better ways of handling this – having 800 PHP children is not ideal –
> look at ways of using static servers if you can e.g.
>
>- you may be able to sit another apache in front of this one to handle
>the static requests {using the event mpm} and use this one to server PHP
>code;
>- or more this to mpm event model and use one of the fcgi wrappers for
>PHP {mileage may vary on this if you have a large number of PHP code
>basese};
>
>
>
> *From:* Marc Serra 
> *Sent:* 14 June 2021 10:08
> *To:* users@httpd.apache.org
> *Subject:* [users@httpd] Improve memory use [EXT]
>
>
>
> Hi again,
>
> I got an old Ubuntu server 16.04 with apache 2.4.18 serving 140 different
> domains.
>
> The server has 8 vCPUs and 16GB of memory. It's a virtual server hosted in
> Digital Ocean.
>
> As you can see above, the average memory use per apache process is 93MB.
>
> It's possible to improve that? If not, why is so much memory used? In
> other servers with similar configurations but with fewer hosted domains and
> low resources (see at the bottom of this email), the memory usage is much
> lower. Is it due precisely to the number of domains hosted? If not, what?
>
> Sorry to insist on the memory used by each apache process, but I need to
> improve it (if it's possible).
>
> # ls /etc/apache2/sites-enabled/|grep -v ssl |wc
> 140
>
> # cat /etc/issue
> Ubuntu 16.04.6 LTS
>
> # apache2 -V
> Server version: Apache/2.4.18 (Ubuntu)
> Server built:   2019-10-08T13:31:25
> Server's Module Magic Number: 20120211:52
> Server loaded:  APR 1.5.2, APR-UTIL 1.5.4
> Compiled using: APR 1.5.2, APR-UTIL 1.5.4
> Architecture:   64-bit
> Server MPM: prefork
>   threaded: no
> forked: yes (variable process count)
> Server compiled with
>  -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=256
>  -D HTTPD_ROOT="/etc/apache2"
>  -D SUEXEC_BIN="/usr/lib/apache2/suexec"
>  -D DEFAULT_PIDLOG="/var/run/apache2.pid"
>  -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
>  -D DEFAULT_ERRORLOG="logs/error_log"
>  -D AP_TYPES_CONFIG_FILE="mime.types"
>  -D SERVER_CONFIG_FILE="apache2.conf"
>
> # apache2 -M
> Loaded Modules:
>  core_module (static)
>  so_module (static)
>  watchdog_module (static)
>  http_module (static)
>  log_config_module (static)
>  logio_module (static)
>  version_module (static)
>  unixd_module (static)
>  access_compat_module (shared)
>  alias_module (shared)
>  auth_basic_module (shared)
>  authn_core_module (shared)
>  authn_file_module (shared)
>  authz_core_module (shared)
>  authz_host_module (shared)
>  authz_user_module (shared)
>  autoindex_module (shared)
>  deflate_module (shared)
>  dir_module (shared)
>  env_module (shared)
>  expires_module (shared)
>  filter_module (shared)
>  headers_module (shared)
>  mime_module (shared)
>  mpm_prefork_module (shared)
>  negotiation_module (shared)
>  php7_module (shared)
>  rewrite_module (shared)
>  setenvif_module (shared)
>  socache_shmcb_module (shared)
>  ssl_module (shared)
>  status_module (shared)
>
> Relevant part of /etc/apache2/apache2.conf ...
> 
> ServerLimit 800
> StartServers10
> MinSpareServers 200
> MaxSpareServers 400
> MaxRequestWorkers   800
> MaxConnectionsPerChild  1
> 
>
> # free -m
>   totalusedfree  shared  buff/cache
> available
> Mem:  160467198 496 2328351
>  8187
> Swap:  4095 2433852
>
> # ps aux | grep apache
> root  1204  0.0  0.2 431016 47312 ?Ss   May04   7:43
> /usr/sbin/apache2 -k start
> www-data  4778  0.0  0.4 531744 77132 ?S09:00   0:03
> /usr/sbin/apache2 -k start
> www-data 11661  0.1  0.3 518652 57868 ?S10:00   0:03
> /usr/sbin/apache2 -k start
> www-data 13839  0.0  0.2 443036 45928 ?S10:12   0:01
> /usr/sbin/apache2 -k start
> www-data 14763  0.1  0.2 443004 40676 ?S10:18   0:02
> /usr/sbin/apache2 -k start
> www-data 26848  0.0  0.4 533496 81960 ?S06:35   0:11
> /usr/sbin/apache2 -k start
> www-data 26849  0.0  0.5 537956 96632 ?S06:35   0:14
> /usr/sbin/apache2 -k start
> www-data 26850  0.0  0.5 528608 87912 ?