What's happening in our world

Home / Blog / Label:
Label:

Saturday 07th December 2013 Facebook PHP Virtual Machine Released

One of the holy grails of complex PHP application development is maximizing performance. Not only does better performance mean more manageable server loads, if you're scaling large enough, there can be a number of other dramatic gains in terms of power consumption and energy costs. Few companies are more familiar with this than the social networking giant Facebook, which is coded entirely in PHP and also just happens to be the largest social networking site on the planet. With over a billion active accounts, that's nearly 20% of the entire world's population - almost nobody else is as familiar with complex and robust PHP deployments as they are.
 
When it comes to web deployments of PHP applications, most developers initially choose to write the complicated code in PHP, but as the application scales and the usage levels increase, the more complex calculations are often re-coded using a faster server-based language such as C or C++. Facebook itself did this in the past, using a custom compiler named HipHop that translated the site's PHP code into C++ for faster execution. As in many large development environments, however, this eventually grew to create separate problems, which meant a new solution was called for.
 
Thus began the development of the HipHop Virtual Machine, or HHVM as it's more commonly known. Without getting too deep into the technical specifics, the HHVM translates PHP code into a custom bytecode known as HHBC (you guessed it, Hip Hop Byte Code) which is then processed by an x64 just-in-time compiler, along with a companion bytecode interpreter when absolutely necessary. This allows Facebook's entire staff of PHP developers to work on the entire codebase together, instead of dividing up the development process into PHP and C++, which can often lead to major headaches when it comes time to reconcile.
 
Joel Pobar, a developer at Facebook, cautioned that many developers hoping to gain performance improvements from implementing HHVM may not get the results they want, saying, "Chances are [your code is] spending too much time talking to the database or spending too time talking to the memcache caching layer." In other words, your performance bottleneck isn't likely to be execution speed, as there are other more typical culprits that can be identified by using benchmarking applications. The HHVM is strongly optimized towards  very large PHP codebases with very heavy usage loads, but it may be worth investigating for your next project.

Posted on December 07th 2013 at 10:13pm
0 Comments

Thursday 03rd October 2013 Exploring Continuous Deployment

Following up on our recent project management tips post, today we're going to explore what some have termed the developer's holy grail, known as continuous deployment, continuous delivery or continuous integration. As the widespread adoption of the Internet accelerated, the demand for shorter and shorter turnaround times between planned featuresets and new releases also increased dramatically, and PHP development was no exception. This is what first sparked the Agile development style as a solution, and has lead to a number of successors since then, eventually culminating in the currently popular system we know as continuous deployment.

Essential what CD/CI means is that new features are rapidly and automatically integrated into your main codebase at a much higher frequency than traditional development styles, sometimes even as frequently as multiple times per day. For a PHP-based application in a highly competitive field, the advantages of constantly being on the cutting edge are obvious, but there are some basic requirements and some potentially dangerous pitfalls to be considered before diving into a CD/CI strategy.

First of all, the main idea behind continuous deployment is speed - which essentially means the automation of as much as possible. Automation is crucial, because wasting 16 dev-hours to push out a day's worth of development is hardly continuous. Proper automation begins with implementing software to handle revision control and integration of new elements, the most popular of which currently is Git (which works perfectly with Github, of course). Testing of new features should be as automated as possible, while being completely thorough - without being sure that your new code is flawless, there's no point in releasing it into the wild, as you'll just be hurting your project. This is the step that causes many developers to throw up their hands in disgust, as it optimally relies on clean, focused and disciplined coding and extensively customised test scripts. Last but not least, the final build process should be automated, allowing you to push new versions out the door with an absolute minimum of fuss. Cruise Control and Buildbot are two of the more popular examples of build software, but there are a large selection available.

While that may seem simple on screen, the successful implementation of these strategies can take months to accomplish - but if done correctly, the benefits are incredible. Your PHP application won't be ON the cutting edge, it will BE the cutting edge.

Posted on October 03rd 2013 at 09:25pm
0 Comments

Links

TRY SOURCEGUARDIAN FREE FOR 14 DAYS
Account Login:

login Forgotten Password?
Connect with us
Bookmark
facebook linkedin twitter rss
© Copyright 2002 - 2016 SourceGuardian Limited
Privacy Policy l Terms & Conditions l Company Info l Contact us l Sitemap l PHP Weekly News