We recently converted our web site to https
. After certificate installation and testing we created a 301 redirect in .htaccess. Things went fine for a few days with little apparent performance impact.
Day 3 or 4 we ran into OOM
issues. Over the next few days we would see the same pattern repeated. At about 9:15 AM (when our server starts to see increased load) our memory usage would creep up and often cause the server to kill memcached or mysql. It's hard to understand because we'd see much much greater usage (per google analytics) later in the day with no problems at all.
Server Version: Apache/2.4.25 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 PHP/5.5.38
Server MPM: prefork
Start servers: 10
Min spare servers: 5
server limit: 256
max request workers: 256
max connections per child: 2500*
keep alive: on
keep alive timeout: 1
I lowered max connections because we noticed that the mem usage per child seemed to increase significantly during the problem period. Per htop
RES for each child is usually 25000k. During stress it is over 50000k. So I had a thought that I wanted to increase the frequency new child processes being spawned. Unclear if this made any difference.
We've checked all cron
jobs to ensure that nothing special is scheduled at the stress period.
Does adding ssl
create significantly more mem usage for apache
? Why only at this particular time - not even anywhere near our busiest time (although it might be the time that the usage grows the most).
Update. We removed the 301 redirect to try to definitively determine if this was the cause. Sure enough the server handled the 9:30am rush today without ever showing the slightest memory or cpu strain. So we still have https enabled - but not sure how our http vs https workloads differ atm.
Update 2. rewrite as requested
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
(originally had 301 redirect - but took off pending solving memory issue)