EasyEngine / easyengine

Command-line control panel for Nginx Server to manage WordPress sites running on Nginx, PHP, MySQL, and Let's Encrypt
https://easyengine.io
MIT License
2.11k stars 435 forks source link

HipHop Support #180

Closed duajanuari closed 9 years ago

duajanuari commented 10 years ago

Hi,

It seems HipHop support is nice, they have prebuilt packages, and perform quite better than php5-fpm. Not much changing codes I guess.

Here, take a look at this: https://github.com/facebook/hhvm/wiki#installing-pre-built-packages-for-hhvm

rahul286 commented 10 years ago

Yep. HipHop is on list. We will be putting it on rtcamp.com server later this month. If it works there, we will test it on few more servers on different website.

If all goes well, we will be happy to add it to EasyEngine in future. :-)

rahul286 commented 10 years ago

Related: https://twitter.com/MiteshShah05/status/456444758529814528

duajanuari commented 10 years ago

hello, that @hmd on twitter is me, how i install hhvm is quite simple, just install hhvm from prebuilt packages and stop php5-fpm service.

if you wanna take a look my droplet at digital ocean which hhvm installed, i'd happy to add your public key :)

ovizii commented 10 years ago

How does droplet sharing work? Can I clone yours somehow? I'm just busy with one of my own test-droplets, gave up on hhvm because I installed Debian 32bit and apparently they only have packages for 64bit so far...

rahul286 commented 10 years ago

@ovizii thanks for info on 32-bit

easyenigne supports 32-bit as well so if we need to support hhvm then we will either have to maintain 2 different install scripts internally or force everyone to use 64-bit. Both are not good.

We are installing hhvm today on few servers manually. We will takes notes of our experience. If all goes well, we can make it default in easyengine.

shaneholloman commented 10 years ago

I have functional EE install @MiteshShah setup on Unbuntu 14.04 if you'd like me to clone it for you? Just me know and I will spin it up now...@miteshshah pub-key is already installed to it

ovizii commented 10 years ago

I didn't find this info anywhere but I got a dependency problem with apt-get on Debian 7 32bit so I checked the repos:

http://dl.hhvm.com/debian/dists/wheezy/main/binary-i386/Packages vs http://dl.hhvm.com/debian/dists/wheezy/main/binary-amd64/Packages

rahul286 commented 10 years ago

@shaneholloman Thanks for offer but setup is not a problem.

By believe anything goes into easyengine should be tested on rtcamp.com first. Its less painful to break own sites rather than others. ;-)

Just some time back, I came to know about hhvm doesn't support 32-bit. There is also some thready suggesting hhvm doesn't play nicely with non-mysql databases.

On wordpress sites, there are so many themes and plugins and I just want to make sure hhvm doesn't create any issue for atleast some top themes and plugins.

So here is the flow (for hhvm and every stuff like this gets added into easyengine):

  1. Install and test on our test/staging server
  2. Install and test on our on production server (which runs rtcamp.com)
  3. Install and test on our clients test/staging server
  4. Install and test on our clients production server

Each step usually takes a week. Sometimes more.

It may sound bit conservative approach but even after this, we see people running into issues.

In meanwhile, if you come across any issue or special notes related to hhvm, please share.

We need to ensure 32-bit and 64-bit support for atleast Ubuntu 12.04/14.04 and Debian 6/7.

rahul286 commented 10 years ago

@ovizii https://github.com/facebook/hhvm/wiki#installing-pre-built-packages-for-hhvm has better info.

I see 32-bit and Debian 6 are not supported.

I personally don't use 32-bit anywhere. Not on servers with lower RAM.

Does anybody here use 32-bit?

shaneholloman commented 10 years ago

I use 64bit only

rahul286 commented 10 years ago

Sorry for accidentally closing this. Reopend now.

ovizii commented 10 years ago

hm, I tried 32bit on a low-end droplet, will give 64bit a try too :-)

adrianocr commented 10 years ago

Any updates on this? It would be cool if EE did this out of the box. But if it does not, that's ok too. I followed the following two tutorials and got HHVM working perfectly with my wordpress install. Works like a charm! https://kinsta.com/blog/hhvm-and-wordpress/ and http://fideloper.com/hhvm-nginx-laravel

gau1991 commented 10 years ago

@adrianocr Currently we are testing HHVM on our servers. If all goes well then soon EE will land up with HHVM.

coreyallen commented 10 years ago

Cool I'd love to hear your experiences with HHVM so far.

adrianocr commented 10 years ago

@gau1991 @rahul286 running EE 1.3.8 I was able to do what I stated above (https://github.com/rtCamp/easyengine/issues/180#issuecomment-49685080). But now in version 2.0.1 I can't figure out how to do this. I have a wt3c wordpress site that was created by EE. I went to /sites-available/domainname.conf and added

location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
include        fastcgi_params;
}

but it didn't work. I tried including the hhvm.conf file in the domainname.conf file, I tried replacing the php.conf file inside /etc/nginx with the hhvm.conf file (renaming it to php.conf, of course), I tried adding the location block inside w3tc.conf, etc. Nothing seems to get wordpress to load using HHVM. I have a test file at domainame.com/hhvmtest.php with the following inside

<?php
echo  defined('HHVM_VERSION')?'Using HHVM':'Not using HHVM';

It states "Not using HHVM". If from the command line I run hhvm hhvmtest.php it works perfectly and states "Using HHVM". So can you guys point me to the right files/directory for me to set this up? Should I post this on the forum? Thanks!

gau1991 commented 10 years ago

@adrianocr , We have written a small tutorial for HHVM with EE 2.x, https://github.com/rtCamp/easyengine/wiki/HHVM-with-EE-2.x.x Please go through this

adrianocr commented 10 years ago

Hey, guys, sorry for the delay! I was a bit busy for a few days. The above guide worked perfectly! WordPress is purring like a well oiled kitten (I might have gotten my metaphors mixed up there). I wanted to know if there is anyway to bypass hhvm and use php5-fpm? So basically have PHP fall back to the backup. Reason I ask is because some apps aren't hhvm ready (like Drupal and CraftCMS) and I would like to run them side-by-side in the same server. Maybe a PHP location block inside the specific domain.conf?

gau1991 commented 10 years ago

@adrianocr , I am assuming you have created either PHP or MySQL site with EE You need to do following settings: Fist copy php.conf to php-new.conf

cp -v /etc/nginx/common/php.conf /etc/nginx/common/php-new.conf

Then open php-new.conf

vim /etc/nginx/common/php-new.conf

and change from

        fastcgi_pass php;

to

        fastcgi_pass 127.0.0.1:9000;

Now edit your site

ee site edit example.com

and change

        include common/php.conf;

to

        include common/php-new.conf;

Done, now your PHP/MySQL site example.com will use FPM instead of HHVM

rahul286 commented 10 years ago

@gau1991 please share upstream and HHVM/FPM failover style config we are using on our servers. It may benefit others and we might get some feedback from early hhvm adaptors. :-)

MiteshShah commented 10 years ago

@rahul286 Gaurav already shared a link in above comments https://github.com/rtCamp/easyengine/issues/180#issuecomment-49974742

adrianocr commented 10 years ago

@gau1991 @rahul286 worke perfectly. I now have WordPress running on HHVM and Drupal on PHP on the same server. Also installed CraftCMS to start plying around with it and it is also running on PHP since it crashes on HHVM. All on the same server, and everything is running well :)

khairulfaizi commented 9 years ago

Anyone having memory issue with HHVM on OpenVZ container? No problem in KVM or Xen though.

ghost commented 9 years ago

The install of HHVM went fine and all sites loaded fine except SSL enabled sites, so I had to revert the upstream config to get SSL sites active again. The sites fail to load anything. Please advise. :)

Btw, The php page showed HipHop but the X-Powered-By showed EasyEngine.

joeguilmette commented 9 years ago

FYI:

https://rtcamp.com/tutorials/php/hhvm-with-fpm-fallback/ no longer works with EasyEngine 2.2.1

Running $ sudo /usr/share/hhvm/install_fastcgi.sh outputs:

Checking if Apache is installed
WARNING: Couldn't find Apache2 configuration paths, not configuring
Checking if Nginx is installed
Detected Nginx installation
Checking for custom Nginx configuration
WARNING: Detected clashing configuration. Look at /etc/nginx/hhvm.conf for information how to connect to the hhvm fastcgi instance.
ghost commented 9 years ago

I have found other issues that I believe are unrelated to SSL found in my previous comment.

csfalcao commented 9 years ago

I got HHVM 3.4 to work in a Wordpress VPS in DO (NginX+MariaDB 10) everything is working but the site is dead slow, I can't find why.

pnommensen commented 9 years ago

If HHVM support is added I would recommend the option to be enabled per website instead of entirely replacing php5-fpm, or using as global fallback. It's worked great for me but still needs a lot of testing with thousands of plugins/themes.

rahul286 commented 9 years ago

HHVM support will be added but enabled per site only on demand.

Some examples:

ee site create example.com --hhvm #for new sites
ee site update example.com --hhvm #for existing sites

Also, for every HHVM site FPM will be always there as a fallback option via nginx's upstream module.

iouxui commented 9 years ago

With some pretty ruff testing compliments of Blitz.io on a EE multi-site installation w/ HHVM active and PHP5-FPM as a fallback, IMO, you really shouldn't run in to any issues (with WordPress) other than a lack of sockets being available (in the case of pounding the server with a simple stress test - far from realistic, of course, but it gives an idea of what to expect).

That was with on a 2GB VPS from DigitalOcean (SSD).

WordPress was given an increase from baseline memory allocation to 128MB (via wp-config.php) and Query Cache Type (in my.cnf) was set to 1. Nothing else was modified for the test and we came out with just 1 error / test when performing 10 back-2-back blitzes with 230 users over a 1 minute period of time (which according to them comes out to between 8-10m hits - again, not realistic).

Server Loads never went above .2-.3 during the entire test (and we didn't wait for them to come back down), so overall, I'd say it works pretty well. I used both Ubuntu 14.04 and 14.10 (64bit) and none of the other (suggested) HHVM configuration was done.

That said, HHVM does tend to fail often, but with PHP5-FPM as a backup, it's not even noticeable as it seems to instantly pick up where the requests to HHVM left off.

Just for the purpose of testing things further, I'm about to build a custom LNMP stack to test things further as I typically use quite a few more options when it comes to blocking files, blocking bots, and also blocking queries through NGINX so we can work towards reducing injections. WordPress does a pretty good job on it's own, but their $wpdb->prepare isn't a replacement for PDO :).

@joeguilmette That's a standard error. That's HHVM testing to see if you have NGINX installed and if you are potentially using a custom configuration. This check is performed so that, during the install, HHVM doesn't overwrite your configuration files. All that error means is that you will need to make the changes by hand by using the tutorial provided by RTCamp :).

jmn00 commented 9 years ago

I tested HHVM with an ee 2.2.2 nginx+fastcgi+W3TC install per the HHVM rtcamp tutorial. Things went smoothly. Only logged errors had to do with W3TC--a bug they say will be fixed in next update.

I was surprised to experience slightly slower page loads (~200-600ms) where pages were cached (compared to same ee config without hhvm). The test site was a clone of an existing Wordpress site, thus many variables could be responsible for this--not necessarily the ee/tutorial config.

jarylwang commented 9 years ago

Same here as @jmn00 on fresh install of --wpfc (w3TC installed), enabling object cache and database cache as memcached no issues, and blazing fast admin panel.

but on upgrade to hhvm admin panel doesn't respond properly. also, i noticed php version was 5.5.x without opcode cache installed.

rahul286 commented 9 years ago

@jmn00 and @jarylwang can you try disabling W3TC cache altogether can compare hhvm performance? W3TC backfires sometimes.

jmn00 commented 9 years ago

@rahul286 I set up another install and this time hhvm performance did not hinder cached page loads, even with W3TC running. Now running hhvm on my personal blog without issues. Uncached pages are loading ~1sec or less, with cached pages ~500ms on average. That's fast. Think I'll stick with hhvm for now.

As it happens, I tested mod_pagespeed with this setup per rt tutorial and found slight improvements though it failed to combine javascript and css files (and yes, I uncommented those filters and tested with W3TC uninstalled). I'm keeping mod_pagespeed on for now but using W3TC to combine css and js.

pnommensen commented 9 years ago

afaik, PHPMyAdmin requires mysqli immediately, and HHVM still does not support this but will do further testing today.

aristovia commented 9 years ago

Fantastic!!! Installed HHVM with ee. Site powered by WordPress. I use plugin (PHP/MySQL CPU performance statistics) to test basic server environment performance. For ee PHP-FPM (5.5.21-1+deb.sury.org~trusty+2) out of the ee box general PHP Test time (for all tests ) was 12,66 seconds and PHP performance index was 790. After installing HHVM first run showed 4,83 seconds and performance index 2070. Second run showed even better results 1,22 seconds and performance index 8197. I gues it's 11X better results :-) I'm surprisingly shocked 0_0 Results even outperform standart server results which plugin developers use to indicate if your server is fast or slow.

rahul286 commented 9 years ago

@aristovia Thanks for sharing your experience.

We hope to make HHVM as default in EE 3.1 :-)

jmn00 commented 9 years ago

Are you including JIT (just in time compiler) configuration?

MattyLB commented 9 years ago

@Johnathan have you ran into those pesky "TC FULL" errors that end in HHVM crashing and no FPM fallback? Its been happening to me about once a week as the hhvm caches build and gives no warning signs. Has something to do with the cache size parameters for various cacheing stages hhvm puts content through as it ages, eg frozen, cold, etc. I saw claims that raising memory limits on a couple of the cache levels helped prevent the TC Full errors, just not sure why and if they would work for an EE-based environment

Aside from this somewhat preventable issue, I've had zero problems with hhvm using EE on standard and mu sites with several dynamic content plugins. HHVM definitely has my vote once this is addressed On Feb 14, 2015 5:22 AM, "jmn00" notifications@github.com wrote:

Are you including JIT (just in time compiler) configuration?

— Reply to this email directly or view it on GitHub https://github.com/rtCamp/easyengine/issues/180#issuecomment-74371371.

w33zy commented 9 years ago

Does anyone here notice HHVM's memory usuage slowly creeping upwards? I am running it one a new WP install I notice creeping past 65% memory usage.

cssinf commented 9 years ago

I have tried HHVM with mysql previously and it was working fine at ubuntu 14.04 but some time it crashes so not used for production site. Today i tried using ee and HHVM together using 2GB linode debian 7. Ee is working fine without HHVm but when i add HHVm i get an error "Error establishing a database connection" usually this happen when our wp-config.php is missing the db details but as ee settings are used so no change in the db details. i used these guides for the setting at Debian 7

Working fine https://rtcamp.com/easyengine/ http://docs.rtcamp.com/easyengine/commands/site/create

Getting error on this part https://rtcamp.com/tutorials/php/hhvm-with-fpm-fallback/ https://github.com/facebook/hhvm/wiki/Prebuilt-Packages-on-Debian-7

Please help me to understand the root cause of this issue.

puikinsh commented 9 years ago

I am testing EE 3.0.4 with HHVM 3.6 and I am having the same problem as @cssinf. However, I am using Ubuntu 14.04 and WordPress multisite with subdirectories and still getting "Error establishing a database connection". Log files aren't helping either. I tested both upgrading my existing DigitalOcean droplet as well as created a completely new one but with the same error. The only thing that is working is fallback to PHP-FPM.

Update(1): WordPress multisite is not to blame as it doesn't work with a clean server and clean WordPress install either. Update(2): I fixed this problem by following these suggestions

w33zy commented 9 years ago

@cssinf @pulkinsh there is an issue with the MySQL port used in the 3.6.0 release, you may want look at this https://github.com/facebook/hhvm/issues/5002

cssinf commented 9 years ago

Dear @puikinsh and @w33zy i have used this solution yesterday "wordpress' wpconfig.php file to use 127.0.0.1 instead of localhost." and wordpress was running fine but bit slow . i have to check why it is..I was busy with wp-types plugins which are not compatible with HHVM so forgotten to update here. @w33zy Thank you for the info and help ..

w33zy commented 9 years ago

@cssinf can you keep and eye on the memory usage of hhvm with this new update? check to see if it is slowly creeping upwards.

joeguilmette commented 9 years ago

Oh how I wish this was moved to 3.0...

cssinf commented 9 years ago

Sure @w33zy i will let you know , but we have plenty of ram for hhvm to consume... I have to test https + HHVM + non compatible wordpress plugins ... https is too slow and in india we don't have any ec2 / linode / DO data centres ,gtmetric show 5sec + for website....

rahul286 commented 9 years ago

Related to https://github.com/rtCamp/easyengine/issues/199

Final testing and discussion will be done on https://github.com/rtCamp/easyengine/issues/199

Please follow https://github.com/rtCamp/easyengine/issues/199

rahul286 commented 9 years ago

@joeguilmette we hope to add it in 3.1

In 3.0 we were changing programming language so we avoided new features purposely. We did not want to break any old site.

joeguilmette commented 9 years ago

You guys are awesome. Keep up the fantastic work. On Tue, Mar 17, 2015 at 20:53 Rahul Bansal notifications@github.com wrote:

@joeguilmette https://github.com/joeguilmette we hope to add it in 3.1

In 3.0 we were changing programming language so we avoided new features purposely. We did not want to break any old site.

— Reply to this email directly or view it on GitHub https://github.com/rtCamp/easyengine/issues/180#issuecomment-82363008.