APC pre-compiled distro

You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!
public
deekayen - Mon, 2008-03-10 20:01

This is the result of a chat in IRC one day. It got really positive feedback, but the tone was suggested it would never be done. I don't know why it couldn't actually happen.

I'm thinking of a project module add-on, patch, something that integrates with APC (or other byte caching engine) to compile every PHP file in the Drupal core (and maybe contrib if there is extra time) before packing it up in .tar.gz. It would obviously mean adding more output options to the download pages, maybe some config options to contrib authors to allow/disallow, and whatever other creativity that the applicant can propose.

Two problems here. One, why

chx's picture
chx - Sat, 2008-03-15 23:40

Two problems here. One, why this is better than me just installing APC or Xcache? Two, is this even possible? Never knew you can save the APC bytecode cache.


I'm also not crazy...

webchick's picture
webchick - Sat, 2008-03-15 23:42

..about a project that requires futzing on Drupal.org. There are all kinds of privacy and logistical issues around supplying DB dumps to people, and I'm not sure how else this could be throughly tested before it's deployed.


doesn't have to be d.o for soc

deekayen - Mon, 2008-03-17 13:11

Project is still available for download outside getting a copy directly from d.o. What would be needed is some buy-in so the student would know what is required to make it something that could be somewhat easily dropped into d.o, not necessarily to have actual d.o access.

Maybe not exactly APC

deekayen - Mon, 2008-03-17 13:15

Like Khalid said, maybe not exactly the APC engine. Making compiled files available so it's faster than a regular default install makes Drupal that much cooler and better prepares sites for the occasional slashdotting experience they don't regularly have and don't expect.

hmmm....

JBrauer's picture
JBrauer - Sat, 2008-03-15 23:42

I think there could be a couple of issues with this... It doesn't seem like a large enough project to be a SoC effort. But more critically it seems that users who are setting up APC or any other cache on a server have to know enough to do what of this they would want to by themselves and so a distro would lead to more potential problems than solutions. So I end up at -1 for this.

--
Blog: Adding Understanding | Drupal Developer Search | Drupal Services: Brauer Ranch


Don't think so

kbahey's picture
kbahey - Sat, 2008-03-15 23:44

I don't think that APC allows for an external object format, like for example .php -> .phx or .pho. It does the compilation internally. I don't know that the tokenized code is available for direct execution by the Zend engine.

However, I like the direction you are taking, and for a long time, I have been meaning to try Roadsend's PHP Compiler, which converts PHP into native executables.

In the future, PHC may be an option too.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.


Will mentor it even ...

kbahey's picture
kbahey - Sun, 2008-03-16 00:13

I am interested in this, with Roadsend (the only option at present).

So, I am willing to mentor this project.

+1 from me.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.


the bcompile module uses APC

AjK@drupal.org's picture
AjK@drupal.org - Sun, 2008-03-16 00:34

the bcompile module uses APC parsing/grabbing system to produce tokenized output. However, as JBrauer points out above, those using an opcode cache will normally know what they are doing already anyway.

APC stores the opcodes in shared memory after initial compile so I don't see what speed gains you'd get with directly injecting the opcodes over a one time compile/inject. So, -1 on the APC route from me.

As for the Roadsend route, it's designed to compile down the PHP opcodes for native running execution on machine it was compiled on (Roadsend doesn't yet support cross compilation). I think Roadsend is more or less designed for desktop applications rather than server applications so I'm not sure what direction kbahey would want this to go?


Yes, native executables

kbahey's picture
kbahey - Sun, 2008-03-16 01:01

It would be interesting to have Drupal with PHP as fast as it can be. Also, it would be interesting to see whether name space issues and dynamic calls will be the same (menu_execute_active_handler, all the hooks, ...etc.).

This leaves only the database as the scalability hurdle, since code cannot be faster than this.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.


Marked "needs work"

webchick's picture
webchick - Sun, 2008-03-23 02:01

There doesn't appear to be a clear consensus here on what would be involved and whether or not it's desirable as a SoC project.

I cross-posted to the high performance group so we can get feedback from them.


Limited real world advantages?

bartvb@drupal.org - Thu, 2008-04-10 12:04

IMO offering pre-compiled executables is something that would only benefit a small number of people that are already very knowledgeable when it comes to performance optimization and PHP bytecode. For the it would be trivial to create these packages on their own. 99% of Drupals userbase is not able to use pre-compiled files and I wouldn't know what advantage it would be to the other 1%. If you use APC then APC will compile the .php file the first time it gets used (which takes a split second) and then it saves this compiled code in shared memory at which point it's as fast as pre-compiled files. A disadvantage of pre-compiled would also be the fact that you can't just edit those so if you want to use these file you'll need to know how to create those pre-compiled versions yourself anyway :)

@kbahey:
"This leaves only the database as the scalability hurdle, since code cannot be faster than this."
:) Code can always be optimized :P

Likely True...

Ethic's picture
Ethic - Thu, 2008-04-10 12:47

Even using Roadsend, it would require a rather specialized set up to allow access to the compiled binary.

That said, it would be an interesting academic project to see exactly what speed benefits are gained from a precompiled drupal. At the very least worth of an article.

A profiler module might help in measuring such a venture, which is why my SoC application should get reviewed and accepted. Which you can see here.
/samelessplug


deekayen if you want higher

jenot - Thu, 2008-04-10 16:49

deekayen if you want higher performance you can use module for php called accellerator.
It is automatic cache with compiller for php scripts. Is now the best way to get fast drupal.