Hacker News new | past | comments | ask | show | jobs | submit login
VK.com's PHP accelerator – kPHP source code (github.com/vk-com)
71 points by acc00 on March 6, 2014 | hide | past | favorite | 26 comments



kPHP doesn't support all of the PHP features - there is no OOP for example. They claim [0] though that kPHP is faster than its competitors. Unfortunately, it seems the documentation is currently available only in Russian.

[0] - http://habrahabr.ru/company/vkontakte/blog/214877/ (it's in Russian, I used Google Translate)


> there is no OOP

So basically it doesn't support 95% of all PHP code written in the past decade?


It also looks as if they haven't updated the website for which this project was intended in the past decade either, it appears as if they stole the design (badly) ten years ago and haven't updated it since. Apparently they have 100M users.

http://vk.com/?z=screen2

Edit: 100M active users, 230M users.


That's awfully optimistic..


That is a bold claim.


It's not really PHP then - it's a language with PHP-like syntax. Still, it is interesting to see people experimenting with the platform and syntax and capabilities and trying to take it to different directions.


It's a pain in the ass to write in English and Russian - Punto Switcher or Keyboard Ninja are very useful for that (they automatically switch between En/Ru). Just a quick FYI if anyone needs it :-)


This is awesome, I was considering applying to vk.com because they seem to be a very good and open house based in St. Petersburg.

I know it's where Snowden went to work too, and they're the ones behind Telegram.

it's interesting how much I've heard about them since I started dating a Russian girl... but, yes, good things.


Yes, it's a beautiful building in the downtown of St.-Petersburg

https://maps.google.com/?ll=59.935336,30.325956&spn=0.002389...

http://en.wikipedia.org/wiki/Singer_House

Interestingly, it was built by Singer Corporation

http://en.wikipedia.org/wiki/Singer_Corporation

and essentially became the first business center in Russia [sic!] as lower floors were for Singer show rooms and the higher floors were rented out for other companies. Nowadays lower floors are housing the central book store («Дом Книги»). At the time it was built, its architecture was considered outlandish, but now it's one of the staples of St.-Petersburg.


Facebook's HHVM (HipHop VM) compiles webpages into native machine code that can be executed directly on the processor. People often confuse HHVM with HPHPc, also made by Facebook. HPHPc came first; it was a converter that converted all the PHP files in a folder into individual C++ files. In other words, you would end up uploading the C++ files to the server, not PHP files. Facebook abandoned HPHPc early on for multiple reasons (it was actually developed by a single developer as a tool for one-time use to convert all of Facebook's existing PHP files into C++, back when Facebook was considering rewriting the website in C++ for improving performance). While the idea for HHVM was loosely based on HPHPc, the approach is much different. HHVM is a standalone replacement for the PHP engine. It has almost 100% support with the native PHP language, up to PHP 5.5, and even (intentionally) reproduces the various bugs in the PHP language, to maintain compatibility. HHVM only replaces PHP, not Apache or anything else in your stack. It is really, really easy to replace it via their FastCGI handler.


I deployed HHVM on a production site as a test, and without changing a single line of code, on average, I saw nearly a 60% decrease in page generation time from the standard PHP binary. Incredible.


Mostly right.

HPHPc produced the C++ code and that was compiled into a single binary executable. The deployment process involved using bittorrent to distribute the blob to all of the production servers.

HPHPc wasn't abandoned per say, it was only deprecated once the performance improvements brought on by HHVM were significant enough to justify the transition.


Sounds like HipHop, Facebook's PHP->C++ translator.

http://en.wikipedia.org/wiki/HipHop_for_PHP

Anyone know how they compare?


HipHop compiles the script natively, while KittenDB seems to converts to C++ and then compiles it. KittenDB seems to have fewer dependencies, meaning it's likely to be less feature rich. This could be down to the fact that HipHop is actually a full stack, while this is just the interpretation layer.

I'm finding it difficult to find any more details because the documentation is in Russian.

I'm interested in the fact that both Facebook and the Russian equivalent independently started work on the same basic idea. It's almost like convergent evolution.


The original version of HipHop also compiled to C++. Very slow to compile C++ actually. HipHopVM is the one that compiles it natively, it's a successor to the original.


It requires additional dependencies because HHVM has to emulate most of the core PHP extension functionality to be compatible with PHP, for example 'mysql_query', etc.


There's a good write up (in Russian) here: http://habrahabr.ru/company/vkontakte/blog/214877/

As HHVM is more performant than HPHPc, it's a more relevant comparison. Even then, it's not entirely apples-apples since HHVM supports (almost) the entire language, whereas kPHP seems to only support a subset. Doing so likely lets them make a lot of performance optimizations you couldn't make otherwise.


given one completely ripped the other off - probably similar?


which copied which?


Nice downvotes. Someone doesn't like the truth. VK basically ripped Facebook verbatim. Now Telegram or whatever its called. They are basically the Russian version of the Samwer brothers.


The downvotes are because no one cares about whether VK ripped Facebook, and your comment is nonsensical.

If this project is not based on the source code of HHVM there is no way a conclusion can be made about its features or performance compared to HHVM, regardless of any relation between VK and FB.


Of all this code, storage should probably be most interesting to outsiders given how fast, reliable and synchronous vk.com is. I've heard they do crazy things with data storage.

I wonder if someone would step up, figure it out and tell the world.


could you explain a little more, what crazy things?


kPHP is not PHP, it's a PHP-like language.


Browsing through the code, no single comment found... (?)


While there is indeed some PHP accelerator code, most of what is open-sourced is piles of domain-specific C code they use _instead_ of PHP, which I find to be an interesting approach.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: