Page MenuHomePhabricator

Switch phabricator from using apache to nginx
Closed, DeclinedPublic

Description

We should switch from using apache to nginx. Reason why is it uses alot less memory and it also has performance improvements. See https://help.dreamhost.com/hc/en-us/articles/215945987-Web-server-performance-comparison and https://theorganicagency.com/blog/apache-vs-nginx-performance-comparison/

Also we are currently hitting an apache bug where it can stall and then freeze phab web requests.

Event Timeline

Change 406243 had a related patch set uploaded (by Paladox; owner: Paladox):
[operations/puppet@production] WIP: phabricator: Switch from apache to nginx

https://gerrit.wikimedia.org/r/406243

Phabricator needs to be restarted every week due to apache stalling every so often. So i am prioritising this as we shoulden't need to restart apache every so often.

I recall one time i had to restart it recently. Have there been more restarts by others? Is it really every week?

@Dzahn yep. Apparently it went unnoticed due to us restarting apache every week. And when we didnt restart it, phab would get slow.

I suggest(ed) we add a puppetized cron to restart Apache once a week on Sunday. But we should also try to find out what is actually happening.

So before we go to such a shotgun approach, I'd like to first:

  1. Try to understand why apache is "stalling". Using strace(1) on the hanging apache processes should give us some indication of what is going on
  2. Given the switch to nginx means also switching to php-fpm or HHVM, I'd like to hear a rationale for why an fcgi server won't hang, while apache mod_php5 would.
  3. Even if we're convinced that mod_php is the culprit, I'd rather first switch to php-fpm while keeping apache with mod_proxy_fcgi (which we also use on appservers).
  4. If that doesn't work, I'd like to find out why, and eventually, once we're sure the problem is apache, we can switch to nginx.

To be clear: I do agree that nginx has some definite advantages over apache for some applications, but I don't see how that could be the thing solving this production issue.

An analytical approach to problem solving is in my opinion a better choice in this case.

For this "Try to understand why apache is "stalling". Using strace(1) on the hanging apache processes should give us some indication of what is going on" an op will have to do that when phabricator next stalls, most likely by the end of this week.

"Given the switch to nginx means also switching to php-fpm or HHVM, I'd like to hear a rationale for why an fcgi server won't hang, while apache mod_php5 would." i would prefer php-fpm over hhvm as hhvm is being phrased out from prod.

"Even if we're convinced that mod_php is the culprit, I'd rather first switch to php-fpm while keeping apache with mod_proxy_fcgi (which we also use on appservers)."
yeh we could try it with apache first.

mmodell lowered the priority of this task from High to Low.Jan 31 2018, 10:41 PM
mmodell moved this task from To Triage to Misc on the Phabricator board.

Change 406243 abandoned by Paladox:
WIP: phabricator: Switch from apache to nginx

https://gerrit.wikimedia.org/r/406243

Given the underlying issue has been resolved and we see no performance issues with Phabricator that I'm aware of I would tend to NOT do this and keep using Apache just like we do for tons of other things.

+1 to set it as resolved. I believe there could be been some bugs, but also performance issues in the past were due to the old search architecture + some misbehaving scrapers for which now we have a documented procedure to block. I would leave the ultimate decision if to close this to phab owners, e.g. @thcipriani , if they agree.

something between resolved and declined. please feel free to reopen though if you feel differently about it.