1

Topic: New Feature Request - HHVM - Facebook Hip Hop

Since you are already implementing NGinX to be the Primary Driver, you should heavily consider running HHVM instead of PHP-FPM or other methodologies. HHVM is up to 5x faster, under far more active development and backed by Facebook. PHP is the most common language used on web servers so it should be running as fast as possible. Its rather easy to implement into NGinx, just the configurations get finnicky. Please at least include it as an optional, opposing PHP-FPM.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: New Feature Request - HHVM - Facebook Hip Hop

Would you like to try to integrate it and share your experience and step-by-step tutorial?

3

Re: New Feature Request - HHVM - Facebook Hip Hop

ZhangHuangbin wrote:

Would you like to try to integrate it and share your experience and step-by-step tutorial?

It's basically your nginx configuration + standard hhvm installation, then change the php5-fpm socket in nginx for localhost:9000
There is a tiny tweak that has to be made to roundcube, which is creating a symlink to fix the PHP behaviour when using hhvm.

4

Re: New Feature Request - HHVM - Facebook Hip Hop

Could you share some more resource? any useful links, etc.

5 (edited by 7t3chguy 2015-01-10 21:50:25)

Re: New Feature Request - HHVM - Facebook Hip Hop

ZhangHuangbin wrote:

Could you share some more resource? any useful links, etc.

Statistics of Improvement:
http://hhvm.com/blog/1817/fastercgi-with-hhvm

https://github.com/facebook/hhvm/wiki/Getting-Started
http://stackoverflow.com/questions/2288 … with-nginx

root@raven:/var/www# cat /etc/nginx/conf.d/default.conf
upstream php_workers {
    server unix:/var/run/hhvm/hhvm.sock;
#    server localhost:9000;
}

server {
       listen         80;
       server_name    _;
       return         301 https://$host$request_uri;
}

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate_key /etc/ssl/private/iRedMail.key;
#ssl_certificate_key /etc/ssl/private/ssl.key;
# HTTPS
server {
    listen 443;
    server_name _;

    ssl on;
    ssl_certificate /etc/ssl/certs/iRedMail.crt;

    root /var/www;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }

    # Roundcube webmail
    location ~ ^/mail(.*)\.php$ {
        include fastcgi_params;
        fastcgi_pass php_workers;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/share/apache2/roundcubemail$1.php;
    }

    location ~ ^/mail(.*) {
        alias /usr/share/apache2/roundcubemail$1;
        index index.php;
    }

    location ~ ^/mail/(bin|SQL|README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ { deny all; }

    # Normal PHP scripts
    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass php_workers;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param QUERY_STRING $request_filename;
    }

    # iRedAdmin: static files under /iredadmin/static
    location ~ ^/iredadmin/static/(.*)\.(png|jpg|gif|css|js) {
        alias /usr/share/apache2/iredadmin/static/$1.$2;
    }

    # iRedAdmin: Python scripts
    location ~ ^/iredadmin(.*) {
        rewrite ^/iredadmin(/.*)$ $1 break;
        include uwsgi_params;
        uwsgi_pass unix:/var/run/uwsgi_iredadmin.socket;
        uwsgi_param UWSGI_CHDIR /usr/share/apache2/iredadmin;
        uwsgi_param UWSGI_SCRIPT iredadmin;
        uwsgi_param SCRIPT_NAME /iredadmin;
    }
    # iRedAdmin: redirect /iredadmin to /iredadmin/
    location = /iredadmin {
        rewrite ^ /iredadmin/;
    }

    # SOGo
    location ~ ^/sogo { rewrite ^ https://$host/SOGo; }
    location ~ ^/SOGO { rewrite ^ https://$host/SOGo; }

    # For IOS 7
    location = /principals/ {
        rewrite ^ https://$server_name/SOGo/dav;
        allow all;
    }

    location ^~ /SOGo {
        proxy_pass http://127.0.0.1:20000;
        #proxy_redirect http://127.0.0.1:20000/SOGo/ /SOGo;
        # forward user's IP address
        #proxy_set_header X-Real-IP $remote_addr;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_set_header Host $host;
        proxy_set_header x-webobjects-server-protocol HTTP/1.0;
        #proxy_set_header x-webobjects-remote-host 127.0.0.1;
        #proxy_set_header x-webobjects-server-name $server_name;
        #proxy_set_header x-webobjects-server-url $scheme://$host;
    }

    location ^~ /Microsoft-Server-ActiveSync {
        proxy_pass http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync;
        proxy_redirect http://127.0.0.1:20000/Microsoft-Server-ActiveSync /;
    }

    location ^~ /SOGo/Microsoft-Server-ActiveSync {
        proxy_pass http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync;
        proxy_redirect http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync /;
    }

    location /SOGo.woa/WebServerResources/ {
        alias /usr/lib/GNUstep/SOGo/WebServerResources/;
    }
    location /SOGo/WebServerResources/ {
        alias /usr/lib/GNUstep/SOGo/WebServerResources/;
    }
    location ^/SOGo/so/ControlPanel/Products/([^/]*)/Resources/(.*)$ {
        alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
    }
}

The above code is working but definitely not final

6

Re: New Feature Request - HHVM - Facebook Hip Hop

Hello.

I would consider HHVM only for bleeding edge testing system :-), but definitely not for production (stable). Installation of HHVM is still "magic" on an old-stable system like RHEL/CentOS/SL 6. Even on RHEL/CentOS/SL 7 it's not very easy and you need third party libraries not included in standard OS/EPEL repo. But, anyway good point to mention HHVM.

Regards,
Stanislav

7

Re: New Feature Request - HHVM - Facebook Hip Hop

stannicek wrote:

Hello.

I would consider HHVM only for bleeding edge testing system :-), but definitely not for production (stable). Installation of HHVM is still "magic" on an old-stable system like RHEL/CentOS/SL 6. Even on RHEL/CentOS/SL 7 it's not very easy and you need third party libraries not included in standard OS/EPEL repo. But, anyway good point to mention HHVM.

Regards,
Stanislav

I've not played with older systems but it was stable on ubuntu trusty, unfortunately incompatible with my webapp so while it'd work well for most users, some will have troubles. Hhvm optionally instead of php5-fpm would be nice, just like an option to not install Apache would also be nice. Both are not necessary but still nice to have

8

Re: New Feature Request - HHVM - Facebook Hip Hop

I'm afraid that (iRedMail) as a solution provider, we cannot afford to switch to HHVM if it's not stable (as you mentioned), it will bring trouble to users. We have to use stable components.