Software

Forum One: Running Drupal on HHVM

Drupal Planet - Thu, 2014-08-14 16:14

Drupal on HHVMLast March, Facebook announced HACK, a new open source programming language for its HipHop Virtual Machine (HHVM) touted to interoperate seamlessly with PHP. Following the announcement, I was fascinated watching everything they attempted with the new release in trying to wring as much performance as possible from PHP. This gave me an idea: Although we don’t face the exact challenges that Facebook does on a daily basis, it would be interesting to see what would happen if I tried running Drupal under HHVM, the latest iteration of Facebook’s execution engine.

Official HHVM packages are only distributed for Ubuntu and Debian, but thankfully some enterprising people have packaged them up for CentOS. So with a quick stand up of a Virtual Machine and some additional packages, we were good to go. To test, we chose a fairly complex site that we developed last year, built on the usual Panels and Display Suite with significant relationships between the content. This meant that on any given page, Drupal was likely to load and render several entities beyond just the one on the page.

I took the current PHP and database for the site and stood it up on a local VM with 4 cores and 6.5 GB of memory. We did some minor optimization of FPM to set the number of servers, along with some increases to the caches in MySQL. Other than that, it’s pretty much a vanilla installation of PHP 5.3 with XCache, Percona 5.5, and nginx. The goal was to provide as much of an “apples to apples” comparison of the two interpreters without as much regard for making everything as fast possible. We then spidered the site and sampled out 1000 URLs at random and ran JMeter to generate 30 concurrent requests against the site running with HHVM and PHP-FPM. We recorded time and load on the server.

PHP-FPM

Starting off, we ran the test against a cold start of the site. We cleared the Drupal cache and restarted nginx, PHP-FPM and MySQL. We then hit the home page with a single request to build the persistently cached items. As the requests started ramping up, the time to complete each one went up as expected.

Average response time sampled every 5 seconds, cold start

Average response time sampled every 5 seconds, cold start

What was happening on the server mirrors that.

Overall CPU and memory usage, cold start

Overall CPU and memory usage, cold start

We checked the actual processes that were generating the CPU and memory usage, in this case only pulling out mysqld since tracking each process from PHP-FHM was challenging.

CPU usage for mysqld, cold start

CPU usage for mysqld, cold start

Memory usage for mysqld, cold start

Memory usage for mysqld, cold start

MySQL was using anywhere from 40 – 60%, with a few spikes to just over 100% of one core. All the other cores were entirely used by PHP-FPM. Similarly, MySQL was using, on average, about 300 MB of memory. I’m not entirely sure what was causing the areas where processing pauses and response times spike. I saw them on all scenarios, and my guess is that they were due to some sort of I/O blocking, maybe from MySQL or nginx.

As a second test, we ran the exact same URLs against the system, clearing the Drupal cache to see if a burn in iteration for XCache and MySQL would help. Overall, it reduced the median response time by a whole 400 milliseconds and increased the throughput by a whopping 2.081 pages per minute. The response times in general were a little more choppy with fewer of the peaks and valleys from the previous run, but the results were pretty consistent.

Average response time sampled every 5 seconds, warm start

Average response time sampled every 5 seconds, warm start

Overall CPU and memory usage, warm start

Overall CPU and memory usage, warm start

HHVM

After that we restarted the machine, switching out PHP-FPM for HHVM. Thankfully, it supports fastCGI, so it was a simple matter of altering the nginx configuration slightly. The setup was the exact same as for PHP-FPM; we made sure that the Drupal cache was cleared and restarted MySQL and nginx. We then hit the homepage with a single request and started up JMeter.

Average response time sampled every 5 seconds, cold start

Average response time sampled every 5 seconds, cold start

The first thing we noticed was that it completed in just under half the time, 6:28 as opposed to 13:21. Every part of the response graph was better, and both the peaks and valleys were significantly lower. The little hiccup at the very start before it dropped, was the JIT compiler running.

Looking at the server stats, those were improved as well.

Overall CPU and memory usage, cold start

Overall CPU and memory usage, cold start

HHVM runs as a single process, so we were able to capture CPU and memory usage separately for them.

CPU usage for mysqld and hhvm, cold start

CPU usage for mysqld and hhvm, cold start

Memory usage for mysqld and hhvm, cold start

Memory usage for mysqld and hhvm, cold start

Just looking at these graphs, it’s pretty easy to tell a couple of things. Namely, both CPU and memory usage for HHVM are improved over PHP-FPM. Peak memory usage for HHVM was just about 320 MB for a total system usage of approximately 20% compared to the 25 – 26% under PHP-FPM. Likewise, total CPU usage was lower with only a couple of spikes to over 90% and the median closer to 60%, compared to consistent spike to 95% CPU and a median closer to 70 – 75%.

Similar to the PHP-FPM test, we also ran the scenario against a warm start of HHVM. Like PHP-FPM, there was very little difference, only about a 200 millisecond difference in median response time.

Analysis

If we are to look at the high level, HHVM compares very well to PHP-FPM.

hhvm-11

hhvm-12

We saw more than double the throughput and less than half the average response time. Combined with the decrease in system resources needed, it’s a pretty compelling argument to switch to HHVM.

There are some important considerations, however. The biggest is that while the HHVM team is attempting to get as close to Zend PHP as possible, they aren’t there yet. As of the latest reports, HHVM passes 99.83% of the unit tests for Drupal, but there’s no idea how whatever idiosyncrasies exist in various contributed modules will affect it. For instance, we couldn’t get GD to work at all, despite all indications that it should. Thankfully, it’s easily replaceable with ImageMagick – for most manipulations. In fact, we didn’t run into any pages during our test that failed with HHVM, but you never know what might not work until you actually run into it. In addition, the testing was done entirely on the front end. While we went through a couple of common scenarios on the administrative side, we didn’t test that thoroughly. Some PHP modules have been ported, such as APC and memcache, and there is work by third parties to add others, such as MongoDB, Ice and Redis, but many modules haven’t and probably will never be.

It’s also a moving target. Right now the HHVM team is looking at around an 8-week release cycle. Presumably there won’t be significant regressions as they move forward, but you never know. Similarly, they are targeting Ubuntu and Debian for official packages, so if you’re running Fedora or CentOS you have to either build from source or depend on a third party repository that may not be up to date.

Disclaimers

The performance results shown above are from running a production site on a very much ‘non-production’ virtual machine running on MacBook Pro with a 2.3 GHz Core i7 processor. There was very little tuning on any portion of the stack to ensure best performance. Load testing was performed from a separate machine over a wireless network, albeit one that was not being used for any other purpose. The load testing did not include any wait time or requests for non-PHP assets and was not intended to simulate real usage, merely to benchmark the performance of the PHP interpreters.

 

Categories: Software

Gábor Hojtsy: All the multilingual happenings at DrupalCon Amsterdam

Drupal Planet - Thu, 2014-08-14 15:51

DrupalCon Amsterdam is coming up in just a few weeks and it is full of opportunities to learn about and get all your questions answered when it comes to multilingual Drupal. What's better, you can get involved making things happen and learn from those implementing the features firsthand. Here are my picks:

Multilingual Drupal 8 site building and programming

  • There is no excuse to not attend some of the sprints at and around DrupalCon. Sprints start two days ahead of the start of the conference on Saturday the week before. And there are still sprints going on the Sunday after the conference. It is not just the last day of DrupalCon itself where you can get involved and make a difference. In fact the leads are actually focusing more on the sprint on the weekend days. Also the weekend sprints are in a really cool venue. The best way to learn is to do!
  • You are looking for more of a directed guide of Drupal 8 still with the possibility to do it all hands-on? Look no further than the Drupal 8 multilingual hands-on lab presented by Aimee Degnan of Hook42 and myself from Acquia. The schedule info is a bit misleading, this session spans two timeslots and lasts two hours. Bring your laptop with Drupal 8 freshly installed!
  • Dive deeper into the APIs of Drupal 8! Francesco Placella from Tag1 presents Multilingual Content in D8: a Highly Evolved Permutated API showing how to code with the new system. While not strictly multilingual, in Field API is dead. Long live Entity Field API! swentel, yched and amateescu show how the most essential content element storage system changed and this is full of multilingual support of course.
Multilingual Drupal 7 site building and programming Moving localize.drupal.org forward

The localize.drupal.org site seriously needs people who care about it enough to devote time to maintaining and fixing bugs. I set up one more BoF to gather people interesting in the well-being of this site titled We love localize.drupal.org. We need to upgrade to Drupal 7, support the whole range of new Drupal 8 APIs, drastically improve performance and then get new features going.

These are all the multilingual pieces that I collected. There may still be more, BoF scheduling just started and I may have missed a session or two. Let us know in the comments what other great events happen around multilingual Drupal. See you in Amsterdam!

Categories: Software

Drupal @ Penn State: Delicious Drush desserts

Drupal Planet - Thu, 2014-08-14 14:03

I'm incredibly lazy, motivated, but lazy; and I hope you are too. This drives all of us to try and automate everything in life and makes Drupal developers look like rock stars of productivity while lounging in sleep pants with their morning coffee. What am I talking about? Drush, and specifically a new form of chain automation with drush that I'm going to be show-casing today. This is something I've been raving about the sandbox / dev build of on twitter for awhile now.

Categories: Software

Code Karate: Multiple Views Part 1

Drupal Planet - Thu, 2014-08-14 13:50
Episode Number: 162Multiple Views Part 1

In this episode you will learn how to set up the foundation of building a view that can display content in multiple ways. This video highlights how to set up the content type and view to display the content. In the coming videos in this series you will learn how to style and apply jQuery to change how the view displays the content.

Tags: DrupalContent TypesViewsDrupal 7Site BuildingDrupal PlanetCSSJavascriptJQuery
Categories: Software

Blair Wadman: How to (almost) eliminate comment spam with Drupal

Drupal Planet - Thu, 2014-08-14 12:23

A few weeks ago I was ready to turn off the comments on my blog. Despite having Mollom running, I was left with a non trivial amount of spam comments to manually deal with each day. It felt like a waste of my time. I love the great comments I get. But there are always people who want to ruin the party, and for the web, it is spammers.

On its own, Mollom is not effective enough.

Tags: Drupal Site buildingPlanet Drupal
Categories: Software

Craig Aschbrenner: Email fields missing feature? Email Confirmation!

Drupal Planet - Thu, 2014-08-14 05:50

On previous Drupal projects I've had the requirement to provide some sort of confirmation email to email addresses entered into an Email (module) field.  These were typically fields like "Work Email" or "Secondary Email".  I had written a few small custom modules to handle these cases but found myself repeating the same thing. I knew that this could be useful as a contrib but never got around to it.

I recently had a requirement to confirm email changes to the user account email (e.g. $user->mail). I went to my goto module for this situation, the Email Confirm module. But this time I decided to dive deeper into what Email Confirm was actually doing... and it looked fairly straight forward.  I was hoping that I could possibly extend this module to be used with an Email field, but that ended up not being the case.

So I decided to take the plunge and create the Email Field Confirm module. Boy was I in for a ride...

The Email Confirm module only works with the User entity which happens to have the $user->data property / db table. The module makes use of this to avoid any schema changes and retains the relationship of the new email address to the user account. I had started out down a similar path but came to realize this wasn't going to work for entities other than the User entity.  Node entities do not have the data property and I couldn't rely on other entity types to have it.  This is the point that I realized this was not going to be a simple module.

Time to really sit down and figure out what this module needed to do.

My goal was to allow for any new email address added to an Email Field to be (optionally) confirmed. A field can be reused on multiple entity types and bundles so I need to allow for configuration at the field instance along with storing any pending email address data down to the specific entity instance (e.g. entity_id). I also noticed that the Email Confirm module would stash the new email address away until it was confirmed so I added that to my list of desired features for Email Field Confirm.

Just tell me what it does already!

Features

At a high level, it met the goals I was after. A confirmation email will be sent to any new email addresses that have not already been confirmed by the same user elsewhere (e.g. another Email field) on the site. A field instance can optionally be configured to save the new email address with the entity or keep the original email address until the new one is confirmed.

This works on both single-value and multi-value Email fields, however there are some limitations with the multi-value field.

With multi-value fields it has proven more difficult to accurately identify what the original email value may be have been. I wasn't able to easily identify if the end user was changing an email address vs. just removing and adding another. It is also easy to re-order the values of a multi-value field so relying on the $delta wasn't helpful.

So with single-value fields we have the capability to retain the original email address until the new email address is confirmed. We also have the option to notify the original email address that a change has been made.

Some other notable features include:

  • Ability to resend a pending non-expired confirmation email.
  • Configure if the acting user (e.g. the user adding the email address) or the entity author/owner is responsible for confirming the email address.
  • Hooks for email confirmation and expiration. This module actually makes use of these to handle updating / revering single value email fields to the new or original value.
  • Rules integration -- with events similar to the aforementioned hooks.
  • Permission to bypass email confirmation. (typically for trusted roles.)
  • Permission to manually confirm any email address. (typically for administrative roles.)
  • Configurable confirmation and notification emails with token replacement.
Beta Release

There is currently a beta release available for download on the Email Field Confirm project page. It has been pretty stable so far. Besides having more sites use the module and report back and defects or feature requests, I hope to get some automated testing (most likely Behat) in place.

Categories: Software

Paul Rowell: Repeatable fieldsets in Drupal: Inline Entity Form Vs Field Collection

Drupal Planet - Thu, 2014-08-14 00:47

My last post on field collections involved revisioning with Workbench Moderation and the issues faced. Since then the module has been developed further, but I've also come across a potential replacement: Inline Entity Form. This is a short comparison of the two modules.

Categories: Software

Acquia: Automatic Module Upgrader for Drupal 8 getting some love!

Drupal Planet - Wed, 2014-08-13 23:34

Back in February at the Acquia Build Week hackathon, Team "Upgrade Roboto" (webchick, Wim Leers, Gábor Hojtsy, xjm, japerry, and estha) published the Drupal Module Upgrader project.

Categories: Software

Zivtech: Philly Dev Camp, an Instructor's Perspective

Drupal Planet - Wed, 2014-08-13 22:43
Earlier this year Zivtech received a Startup PHL "call for ideas grant" from the city of Philadelphia. The project’s goal was to help teach aspiring students or recent graduates today’s top web development technologies and help sculpt the technical landscape of the city. With help from Neomind Labs we have set out to help change the future for 24 students, or devcampers as I like to call them, at the first Philly Dev Camp. Philly Dev Camp is a web developer boot camp focusing on skills that local tech companies are looking for in today's workforce.   I have been an instructor with Zivtech for about a year now, and this is one of the larger--if not largest--classes I have taught. As the instructors, we did not get to learn much about the students before Philly Dev Camp started, but David Hamme, Neomind's Alex Kaplan, and Zivtech President/CTO Jody Hamilton, did great job of choosing the right devcampers for the inaugural 2014 camp. We have been collecting a ton of feedback about the camp so far, and things seem to be going really well from what we have gathered. We probably have a few things to work on, but it's a first for everyone this year. We are hoping with the outcome of this year’s camp we can continue working with the city to provide technical education to Greater Philly Area residents and keep the camp going.   Devcampers have already completed 4 weeks out of the 5 weeks of this year’s class. Students have learned a handful of crucial skills so far such as command line basics, the LAMP stack, git for version control, and SASS for front-end development. Many students came into this class just knowing some HTML and CSS, while others have already built their own sites using Wordpress, so the skill levels are varied throughout the class. The most notable characteristic to me about this class is that those that are more advanced are eager to help their less-experienced peers. This means that they are going to work well on teams with multiple developers in the future.   I am only one of the handful of instructors that Zivtech has brought to the table for Philly Dev Camp. Our other 2014 Philly Dev Camp instructors are Jody Hamilton, Sean Wolfe, and Howard Tyson. Each of us was tasked to cover our strongest skillsets. I covered git, MySQL, and Drupal Site Building. Jody has covered command line basics, vim, PHP basics, and advanced Drupal site building and Drupal development. Sean has covered CSS and SASS front end development, and Drupal theming. At the end of last week, Howard started taking the devcampers on a hike through hot new web technologies like Angular.js, Node.js, and newer database systems like MondoDB, redis, and memcache. This week students have been getting a full helping of Ruby on Rails training by Ryan Findley and John Parsons from Neomind Labs. Outside of our instructor team, we have also had some additional help from Zivtech team members Victor Lourng and James Jones.   I had always wanted to be a teacher, so being able to help the students of Philly Dev Camp learn something I enjoy doing, and is a very useful skillset for their future, is a very rewarding feeling. It will be interesting to see how things shape up for the remaining 3 weeks of Philly Dev Camp and where these new skills will take them after the class is over. I’m looking forward to this becoming a yearly thing that we can continue for a long time to help build up Philadephia as a major contributor to shaping tomorrow's web.   Follow Phillly Dev Camp on Twitter at @phillydevcamp. Terms: PhillyDevCampWeb Developer BootcampPDC14NeomindDrupal Planet
Categories: Software

Acquia: Commons Team Improving Contrib & Core

Drupal Planet - Wed, 2014-08-13 22:34

As part of our day-to-day maintenance of Drupal Commons, we often assist with Drupal contributed modules that are included as part of Commons but not specific to the application, whether that means fixing bugs by writing or reviewing patches, or coordinating with other module maintainers and the Drupal Security team to help reduce the time between reported issues and security advisories.

Categories: Software

Mediacurrent: How Drupal is making a difference in South Los Angeles

Drupal Planet - Wed, 2014-08-13 22:22
Mediacurrent gives back to the community through Drupal

In the fall of 2012 while doing a talk at a local conference in Los Angeles I was approached by Oscar Menjivar, founder and CEO of Teens eXploring Technology (TxT), a non-profit organization teaching inner city teenagers from South Los Angeles about technology and leadership.  Oscar was looking into Drupal as a potential technology to include in the summer coding academy his organization holds every year.

Categories: Software

Acquia: Why should I go to DrupalCon? - Rebroadcast - The benefits of being there

Drupal Planet - Wed, 2014-08-13 19:27

With DrupalCon Amsterdam and The Prenote right around the corner, it seemed like a good time to revisit this recording from when I had the tables turned on me at DrupalCon Portland and got interviewed by Ray Saltini from Blink Reaction. He asked me some great questions about Drupal, and especially why you should come to Drupal community events like DrupalCon. See you in Amsterdam!

Categories: Software

Dries Buytaert: Amazon invests in Acquia

Drupal Planet - Wed, 2014-08-13 17:46
Topic: AcquiaDrupal

I'm happy to share news that Amazon has joined the Acquia family as our newest investor. This investment builds on the recent $50 million financing round that Acquia completed in May, which was led by New Enterprise Associates (NEA).

Acquia is the largest provider of Drupal infrastructure in the world. We run on more than 8,000 AWS instances and serve more than 27 billion hits a month or 333 TB of bandwidth a month. Working with AWS has been an invaluable part of our success story, and today's investment will further solidify our collaboration.

We did not disclose the amount of the investment in today's news announcement.

Categories: Software

Appnovation Technologies: How to Enable Disqus On Drupal

Drupal Planet - Wed, 2014-08-13 17:15
This will be a quick tutorial on how to set up Disqus on a Drupal site for commenting. var switchTo5x = false;stLight.options({"publisher":"dr-75626d0b-d9b4-2fdb-6d29-1a20f61d683"});
Categories: Software

Drupal Association News: Get Involved: Volunteer at OSCON and more

Drupal Planet - Wed, 2014-08-13 17:00

What do you get when you bring together thousands of diverse open source developers in Portland, Oregon? Great parties with delicious craft beer! But you also get Linux kernel hackers mingling with Docker devops engineers who are talking with PHP and Perl developers. Great minds from across the world learn from each other to make open source even better at OSCON, the annual open source conference.

This year, 16 amazing volunteers helped represent Drupal to over 4,200 open source developers at the annual OSCON trade show. At the Drupal Association booth, volunteers handed out Drupal stickers, shared how Drupal can be the solution to a broad range of web needs, and talked about the extensive contrib project ecosystem and active Drupal community. Our helpful volunteers also answered a lot of questions ranging from "What is Drupal and how much does it cost?" to "When is Drupal 8 going to be released?"

OSCON will return next year, July 20-24, and we'd love to have you join us to spread the joy of Drupal. To get involved with spreading the word, get in touch the Drupal Association via their contact form or through Twitter.

 

Having a great time at the Drupal booth at #OSCON. Stop by, grab a sticker and say hello! pic.twitter.com/Iyla5RdyQk

— Drupal Association (@DrupalAssoc) July 23, 2014
Categories: Software

InternetDevels: Drupalaton 2014 — dive into Drupal 8!

Drupal Planet - Wed, 2014-08-13 16:45

Our web development army continues its reconnaissance operations on the best DrupalCamp events! August 7-10 we have taken one more strategic point — Hungarian Drupalaton!

A world-wide famous Balaton lake has become a location for one of the biggest Drupal venues in Hungary. InternetDevels company has supplied this event by becoming its silver sponsor!

The participants had no chance for boredom — workshops and code sprints were supported by wonderful launch-breaks and exciting leisure time activities!

Read more
Categories: Software

Trellon.com: Portable Configuration in Drupal

Drupal Planet - Wed, 2014-08-13 16:06

The Drupal community is hard at work delivering the next major release, Drupal 8. If you are already involved, your help is much appreciated. If not, but you would like to help with Drupal core development anre are looking for a way to start, take a look at core mentoring hours. It's a great way for people to get involved, and there are several time slots each week that suit many people's schedules.

Categories: Software

Drupal.org Featured Case Studies: MIT List Visual Arts Center

Drupal Planet - Wed, 2014-08-13 14:30
MIT List Visual Arts CenterCompleted Drupal site or project URL: http://listart.mit.edu/

MIT's List Visual Arts Center is the contemporary art museum and visual art lab at the Massachusetts Institute of Technology in Cambridge. After completing a comprehensive rebrand of the List, we set out to bring that brand to life online. TOKY — the team behind the site's design and development — is a full-service branding and design consultancy with offices in St. Louis, Chicago, and Boston.

Key modules/theme/distribution used: Advanced CSS/JS AggregationAutomatic NodetitlesConstant ContactDateEntity referenceField collectionGeolocation FieldGoogle Site SearchImageAPI Optimize (or Image Optimize)MediaMediaElementRemote stream wrapperSub-pathauto (Sub-path URL Aliases)TypogrifyOrganizations involved: TOKY Branding + DesignTeam members: Daniel Korte
Categories: Software

Pedro Rocha: Split Views filters and sort options in different blocks with Drupal

Drupal Planet - Wed, 2014-08-13 09:02
When i found that exposing the Views filters as a block, to use as a search block for a Search API page, would show the sort options together, i thought: "Oh sh**". I instantly thought that it would be painful to get a "specific use case" like this one working quick. But i'm working with Drupal, right? hehe In 3 steps, the solution was simple, by the community:
Categories: Software

MariqueCalcus: Our first Drupal 8 theme get updated

Drupal Planet - Wed, 2014-08-13 00:34

Today we are excited to announce the latest release of our Drupal 8 theme Prius. The last build support the freshly baked (Drupal 8 Alpha 14). The migration from alpha13 to alpha14 was pretty smooth. We just run into some weird issues that we've traced down to the libraries implementation. We'll explain how we fixed it to prevent you from some Drupal headaches.

Check out the code on drupal.org or read our dedicated blog entry if you want to find out more about our first Drupal 8 theme.

Read More...
Categories: Software

Pages