I am at barcamp and I have a guy sitting besides me who seems to know PHP -- runs under the name "Rasmus Lerdorf" -- and I demo'd split to him. Results are: Drupal HEAD core eats 6 megabytes, with split it eats 1.5 megabytes on admin/modules. We divided memory usage of every module by filesize and there seems to be a very constant 5-6 multiplier. This means that if you have 8 megabyteslimit then you can install another 3-400K of modules. Rasmus says that memory usage won't be seriously affected by APC.

With APC I need to benchmark performance but it seems that split is cool!

Also, the core team are busy bees: we have more than 30K lines of code!

Comments

robertdouglass’s picture

http://pecl.php.net/package/APC (coming to PHP core as of PHP 6)

- Robert Douglass

-----
Rate the value of this post: http://rate.affero.net/robertDouglass/
I recommend CivicSpace: www.civicspacelabs.org
My sites: www.hornroller.com, www.robshouse.net

robertdouglass’s picture

- Robert Douglass

-----
Rate the value of this post: http://rate.affero.net/robertDouglass/
I recommend CivicSpace: www.civicspacelabs.org
My sites: www.hornroller.com, www.robshouse.net

Anonymous’s picture

Anyone care to enlighten the rest of us on this mysterious 'split' thingy?

heine’s picture

Summary:

Split is a script that extracts all functions from Drupal and gives them their own file. When a function is needed it is loaded.

Everything that isn't used is not loaded; this saves a considerable amount of memory (many people have an 8 MiB limit).

Crell’s picture

And what's the CPU cost involved in all of those extra disk I/O hits? That can't be trivial.

--
Larry Garfield
http://www.garfieldtech.com/blog

--
Larry Garfield
http://www.garfieldtech.com/
Thinking Functionally in PHP: https://leanpub.com/thinking-functionally-in-php

robertdouglass’s picture

While there are lots of unanswered questions, it is clear that running in split mode is good for those with RAM limitations, and that the RAM overhead is generally higher for Drupal than the disk I/O. CHX isn't proposing that everyone run in split mode; core needs four small functions in order to give people the choice. If they want split mode, they run the split script. If not, they leave it alone.

- Robert Douglass

-----
My sites: HornRoller.com, RobsHouse.net

beginner’s picture

see:
http://drupal.org/node/35657

and why this is needed:
http://drupal.org/node/32262#comment-53036

--
http://www.reuniting.info/
Healing with Sexual Relationships.

seanr’s picture

Sounds interesting, but I have a couple of questions. Is this PHP5+ or is it not version specific? Would it affect the way we write modules in any way? What kind of server requirements would there be?

Sean Robertson
www.webolutionary.com/freedom
webolutionary@webolutionary.com

robertdouglass’s picture

I know for sure that he's using PHP4 for this, and that minimal coding standards must be adhered to. What he has basically done is use the PHP tokenizer to parse the PHP files and break them up. If you have a function name() { without the space between the () and {, split mode won't split, I believe, so yes, some coding standards must be maintained. Other than that, the webserver has to be able to write to the files directory. Chx will know more if there are other requirements.

- Robert Douglass

-----
My sites: HornRoller.com, RobsHouse.net

mascroft’s picture

Can someone please describe how I might go about implementing split mode?

peterx’s picture

When you graduate from functions to objects and classes, the classes can be automatically loaded by PHP5 using autoload.

Many years ago I built PHP 4 sites using my own automatic loading of classes. PHP cache products made the loading of hundreds of little files almost instantaneous.

The cache makes the files small so they will fit memory. Classes are reused which means that a program loading 20,000 objects might be loading only 100 classes. The whole process of creating an object from a class is little more than a copy from one location in memory to another. The loading of a class from cache is also only a copy from one memory location to another. The creation of objects from a class starts with two copies for the first object then only one copy for subsequent objects of the same class.

As an example using a project run on a Solaris server, which was pretty slow compared to an AMD server, the use of several hundred classes did not slow down a Web page. Converting those several hundred classes into a few thousand objects did little to slow down the Web page. The slow down started around 50,000 objects.

From what I see on several sites, PHP4 and PHP 5, different brands of servers, different brands of cache software, and some systems that preceded the Web, a good cache works better when you have lots of little code chunks. The average Drupal module is 3 to 5 times the optimum size.

Another benefit of lots of little chunks is that administration code is loaded only for administration pages and not for the many times more common visitor page read.

There are many reasons for moving to smaller code chunks, objects and PHP 5 autoload. Every improvement can be made 100% compatible with PHP 4 from about PHP 4.2 onwards. Drupal 5 could inherit all those improvements.

petermoulding.com/web_architect