HHVM/ja


 * ''解説のまとめはHHVM/Aboutをご参照ください. 2014年12月のブログ記事"How we made editing Wikipedia twice as fast"では、HHVM自体の背景ならびに利点の紹介と実装作業のふりかえりをしています.

HHVMはPHPインタープリターツール（より厳密にはランタイムにPHP bytecodeをネーティブの指示に変換する仮想マシンのこと）で、2014年にウィキメディアのサーバに実装されると右記の操作でページ読み込みに要する時間が短縮されました. ログイン利用者のページ閲読、またログイン状態を問わずページの編集を保存するとき.

ロードマップ
HHVM is a new way for websites to run MediaWiki (written in PHP). It is sometimes known by its full name HipHop Virtual Machine and has a just-in-time compiler (JIT). HHVM should speed up page viewing for logged-in users and also speed up the saving of edited pages for all users.

このページではウィキメディアが推進するMediaWikiのHipHopサポート業務ならびにウィキメディア製作のウィキ群への実装が主題です.

HipHopコンパイラの成り立ちとしてはFacebookのプロジェクトであり、コンピュータ言語の加速を目的としたPHPコードからC++への変換作業が含まれました. その後、Facebookが同プロジェクトを中止、現在はHHVM自体の開発へと努力を移しています.

製作クラスタで2014年にHHVMを実装する全体案は次のとおりです.


 * βクラスタへの実装（他の準備と並行して作業）✅
 * 2014年7月21日の週：製作クラスタのジョブランナー数件に実装✅
 * test.wikipedia.org アプリケーションサーバに実装✅
 * Varnishモジュールの実装を介してアプリケーションサーバ群に部分的に実装を可能にする✅
 * 限定的にごく少数のアプリケーションサーバに実装✅
 * 段階的にアプリケーションサーバ群への実装を進めてHHVMの使用を大多数のサーバに広げる✅
 * その他のサービスに実装✅

HHVMの作業
Phabricator: 未完のタスクと全タスク.

設計思想
It is a well-studied phenomenon that even small delays in response time (e.g. half of a second) can result in sharp declines in web user retention. As a result, popular websites such as Google and Facebook invest heavily in site performance initiatives, and partially as a result, remain popular. Formerly popular sites (such as Friendster) suffered due to lack of attention to these issues. Wikipedia and its sister projects must remain usable and responsive in order for the movement to sustain its mission.

Facebook, as a big user of PHP, has recognized this problem, and invested heavily in a solution: HHVM, a virtual machine that compiles PHP bytecode to native instructions at runtime, the same strategy used by Java and C# to achieve their speed advantages. We're quite confident that this will result in big performance improvements on our sites as well.

HipHop がエンドユーザに与える影響は？
MediaWiki is written in PHP, a language that is interpreted at run-time. The overhead of running this PHP code every time someone views a page necessitates the usage of caching servers, running software such as Varnish, which cache the HTML generated by running this PHP, so that the PHP does not have to run every time a page is viewed. These caches only serve users that are not logged in. Actions which are not affected by the cache, and therefore are affected by the run time of PHP code, include: Therefore, any action we can take to reduce the time it takes for MediaWiki's PHP code will therefore also decrease the loading times of our site for all of our logged in users and anyone who edits anonymously.
 * Any page you view while logged in.
 * Saving pages that you've edited, whether you are logged in or not.

HipHop was written to be a faster, more efficient PHP interpreter than our current interpreter (Zend). It is our hope that by implementing HipHop as a replacement for Zend, our users will notice a tangible increase in the performance of our sites.

MediaWikiがHipHop開発に関与して開発者に与える影響とは？
In our initial sprint of work, due to be finished at the end of March 2014, we hope to make it so that anyone can elect to use HipHop on Beta Cluster instead of Zend. This will be on a totally opt-in basis which can be disabled at any time. This will allow the MediaWiki Core team to gauge the performance of HipHop against that of Zend directly using our current test infrastructure, instead of just estimating theoretical performance increases. It will also create a development environment that will help us see how much work is needed to make HipHop compatible with MediaWiki, and as such let us create an estimate for how long it will take us to get HipHop live on production as a full replacement for Zend.

For other MediaWiki developers, the consequence of HipHop being deployed in this manner is that if they are using the Beta Cluster as a test environment, they will find it trivial to test how their patches perform using HipHop instead of Zend if they wish to. However, to minimise the disruption of our work, the opt-in nature of the infrastructure will allow developers will be able to continue to develop totally agnostic of the future HipHop migration if they wish to do so.

関連項目

 * HHVM/Vagrant: HHVMにHHVMを設定する
 * Ori presenting at @Scale about migrating to HHVM - @ScaleでHHVMへの移行について説明するOri
 * HHVM in production: what that means for Wikimedia developers - HHVMと開発：ウィキメディア開発者に及ぼす影響
 * HHVM in production: what that means for Wikimedia developers - HHVMと開発：ウィキメディア開発者に及ぼす影響