Phalcon and Drupal: the winning team?

Monday 13 March 2017

We opted for Phalcon - one of the fastest framework at the moment - for one of our Drupal 8 project. Here's why and how.

Drupal in 2017

Javascript is everywhere -nodeJS backends, a collection of front end frameworks - we integrate websites to multiple third-party services, we work on several environments subject to upgrades and continuous delivery. In 2017 the code of gather multiple applications.

In most cases, Drupal 8 and symfony cater for these issues. Depending on specific constraints, however, we may rely on other languages and tools.

Drupal doesn't solve all the problems

For a new project, we have to integrate Drupal with a many data sets, most of them with large volume, while maintaining optimal performance. We had to make a decision whether Drupal alone was appropriate.

Drupal is a CMS, and is very good at that: managing content. We decided to use it for this and to replace what it does in a less performing manner by lighter and faster solutions.

We're talking about a high traffic website where traffic can increase 30 folds in a matter of minutes.

Phalcon!

What is it?

Phalcon is a PHP framework coded in C. It is a kind of pre-configured and ready-to-use C classes library.

For our project, delay in executing a request impacts the next and with potentially thousand of request to be executed, the load could become incompatible with the close-to-real time expected result.

Phalcon behaves as a REST API in Json to handle raw XML data that have to be aggregated before they are sent to Drupal.

How does Phalcon work?

When a user visits a page it calls the "phalcon," webservice. The webservice parses the XML and sends the data back to Drupal as JSON. 
According to the page date are either:

  • Inserted in the Twig template
  • Directly sent to a widget (VueJS) to handle the display

Phalcon is installed on the server, unlike other frameworks it is like an extension, a bit harder to set up.

Why Phalcon?

As previously stated, the main issue for the site is to handle high number of requests and to keep the cost/performance ratio optimal.

Phalcon also allows clear cut separation between display (Drupal) and business data processing.

This Blog A Way Out analysis, shows Phalcon can handle this.

Conclusion

Still early to draw a conclusion on the Drupal/Phalcon capabilities. However, we ran several tests and saw significant performance improvements.

Phalcon installation and configuration are relatively complex and have to be budgeted for.

Read more here: https://phalconphp.com/fr/