drupal as php extension

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
yakoub's picture

has anyone considered writing drupal core as a php extension ?
that way the drupal core modules would be loaded as part of apache and not part of each http page request .

Comments

Check

all drupal

yakoub's picture

i mean the whole drupal core as php extension, but it seems php extensions must be written in C and i didn't know that

so what i mean is instead of having drupal scripts loaded at each page request, it should be loaded on httpd startup and stay loaded until it stops

so on each page request drupal bootstrap doesn't need to load actual scripts files since they are already loaded , only call the initialization functions .

My opinion

valthebald's picture

If I get it right, this is very close to how Hiphop works. It compiles your whole drupal installation to one executable, which then replaces apache.

Rasmus' keynote in DC CPH

fgm's picture

You should listen at Rasmus Lerforf's presentation at Drupalcon Copenhagen. He briefly touches on the subject.

http://www.archive.org/details/KeynoteRasmusLerdorf

yakoub, you are forgetting

Fidelix's picture

yakoub, you are forgetting that Apache is not the only web server being used with Drupal.
As a matter of fact, it is losing a LOT, and I mean a LOT of ground to better servers such as Nginx, Lighttpd and Cherokee.

Drupal being a PHP extension would work with with any webserver, but you should not confuse php extensions with apache modules. They no relation whatsoever.

Opt Code Cache

Kars-T's picture

An Optcode Cache will give you a lot of speed out of the box and you won't loose many of phps many advantages like easy deployment without any build. Take a look at rasmus keynote. Some functions as a PHP Extension would make sense but not the whole drupal core. Maye we better should build our own operation system. Man that would be fast... ;)

I think someone at DrupalCon

janusman's picture

I think someone at DrupalCon Chicago 2011 even tried out having Drupal as an always-running damon: this means you have a simple(r) dispatcher that recieves the requests, hands them out to one of a pool of always-running "drupal daemons". Not sure what the outcome was =)

Four Kitchens kargo-event

manarth's picture

David Strauss did some work with pressflow and kargo-event to daemonise drupal - the code's a branch on the four kitchens launchpad at https://code.launchpad.net/~fourkitchens/pressflow/6-evented (more information at https://wiki.fourkitchens.com/display/TECH/Using+Kargo-Event+with+Ubuntu...)

--
Marcus Deglos
Founder / Technical Architect @ Techito.

wiki link is broken. Can you

valthebald's picture

wiki link is broken. Can you please check it?

Profiling

fgm's picture

All things said, though, I happen to have been profiling some D7 pages this weekend, and the bootstrap sequence was typically about 12% of the total page duration on single user cycles.

In turn, this probably means that even eliminating completely the per-page bootstrap could only gain this type of performance improvement. Most of the page duration happens during the actual page build, as it should. Which means that, as catch says below, there are better targets for work than this, on which to reap higher improvements rates.

I also tried that approach

Fabianx's picture

I also tried that approach for views ajax requests and it really works well and can save on big drupal installations (lots of modules) a significant time, but the big problem are memory leaks. Drupal is just not build for being run as a daemon, but rather from begin to end.

Pressflow variant

fgm's picture

IIRC this was something mentioned by David Strausss as an experimental branch of Pressflow he had done, once more during Rasmus' keynote.

umm

Spechal's picture

How about building software that doesn't call the same methods (err, functions since Drupal isn't OO) 100+ times instead of creating C extensions.

This is why I spent a very

catch's picture

This is why I spent a very long time profiling Drupal 7 trying to remove as much of that as possible, want to get involved?

100 calls

yakoub's picture

where can i find description about this redundant function calling ?

Most core performance issues

catch's picture

Most core performance issues are tagged: http://drupal.org/project/issues/search/drupal?issue_tags=Performance

There is a lot of low hanging performance fruit left in core, while it is not easy to fix often, if you don't actually know how to write C, it's probably a better place to spend efforts.

Some of those efforts should include making it easier to swap bits of core for PECL extensions, and make it easier to run as a Daemon, but for me I'm mainly interested in changes that benefit large numbers of sites - which at the moment includes those using APC and memcache etc., but not so much those running PHP as a daemon or trying to use Hiphop. These things change, but optimizing our PHP code is worth doing whatever happens.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week