In recent years, the Chamilo LMS software we develop has grown in size, to something that many people might consider unreasonable (to some extent, we do too). This article explains why the Chamilo package for Chamilo 1.11.8 weighs 1100MB (yeah, 1.1GB!) or, in its compressed form, about 285MB.
We’ve heard comments of many people about this. These usually go like this:
- How come a simple web application could take so much space? Aren’t these just uncompiled scripts lying around?
When we explain that most of the size of the code comes from libraries we include, we get:
- Are you not using a lot of libraries that could just be “downloaded upon install”?
- Are you not depending on more libraries than you should?
And these comments convey some truth…
To understand Chamilo a bit better, we need to first quickly analyse its structure. These are the folders you will find in its base directory:
|Folder||Size||Purpose||Could be removed*|
|bin/||0.008MB||This is a simple directory to store the doctrine.php executable script. This is something relatively intermediate in Chamilo 1.11. As we integrate Symfony better, this will be blended with some other stuff.||no|
|certificates/||0.008MB||This is a “placeholder” directory. It doesn’t contain anything else than one script that gives you the certificate you asked for through the URL params (if it exists). Consider this a precursor of the integration of an .htaccess file in Chamilo.||yes|
|custompages/||0.080MB||This directory is not used if you don’t use the “custom pages” feature in Chamilo (allowing you to customize the login page and some other stuff). It’s not really like this uses much space, so let’s not discuss this||yes|
|documentation/||2.1MB||This folder is very important for people using Chamilo in remote areas without an internet connection. It gives vital installation, security and optimization information.||yes|
|main/||121MB||This folder contains the main code of Chamilo (outside of external libraries). It also contains language files, and stuff (see below)||no|
|plugin/||12MB||This folder contains the code for all the plugins. You could remove its contents if you didn’t use any plugin and removed the “Dashboard” tab in Chamilo.||yes|
|src/||4.1MB||This folder contains some code of Chamilo. Together with main/, this is most of the code that Chamilo needs to work.||no|
|vendor/||468MB||These are all the PHP libraries on which Chamilo depends. These are *all* downloaded through Composer, so technically we could deliver Chamilo packages without this huge 45% size chunk. The issue would be that anyone wanting to install Chamilo would have to know how to install and use Composer.||no|
|web/||258MB||This is pretty much the public replica of app/Resources that we saw earlier.||no|
* The directories described as “removable” could be removed directly or with a minimum of effort to make some space, but is it worth it?
Let’s talk about the odd ones out here:
app/ – 257MB
What is MathJax, you ask? Well, it turns out it is pretty much the only nice library that allows you to print mathematical formulas on screen in a browser without having to run a process on the server to generate an image each time you save a formula. With that, formulas appear nicely printed as a composition of fonts, and you can copy paste that text to any editor that supports some kind of formula.
OK, so could we do without it? Absolutely! Would that be better for the admin or the teacher? Well, maybe for the admin, but the teacher would have to ask the admin to please download the MathJax “plugin” of Chamilo on the website, install it, enable it and finally get it.
At Chamilo, we focus on our final users: teachers/trainers and students/learners.
main/ – 121MB
This is the “main” code directory of Chamilo. If you look at its contents, though, you’ll soon find that this space is mostly used up by 4 big subdirectories:
- main/img/, 30MB: a directory filled with all the icons we use in the classical Chamilo interface
- main/lang/, 15MB: all the translations of Chamilo (to 64 incomplete languages, but a dozen or so complete)
These altogether make 93MB out of those 121MB. The rest is tool-specific code.
vendor/ – 468MB
OK, so this is the *big* chunk. This is every external PHP library downloaded through Composer, and it includes:
- alchemy/, 93MB, a library to convert file formats
- media-alchemyst/, 25MB, a library to convert media flows
- mpdf/, 103MB, a (good) library to generate PDFs, that supports UTF-8
- phpexiftool/, 28MB, to deal with EXIF printing formats
- phpoffice/, 15MB, a library to read and write Office files
- sonata-project/, 40MB, OK, this one is arguably useless in this version (except for one or two very custom cases)
- symfony/, 41MB, the whole Symfony framework (version 2), which we use to integrate progressively into Chamilo
- zendframework/, 6.4MB, a version of the Zend Framework used *only* for its excellent handling of dates
web/ – 255MB
The web/ folder is kind of a replica of the app/Resources/ directory. This is something we solve in Chamilo 2.0, but at the moment we kind of have to live with it due to a lack of experience when we started Chamilo 1.10. It is also generated when running Composer, so we could live without it if we asked every person installing Chamilo to know how to run Composer and be able to run it on his/her server (which is not always possible).
As you can see, if we stripped down Chamilo from its unnecessary parts and depended on Composer for each and every installation, the main package would be reduced to 195MB, so about the same size as Moodle without any plugin (Moodle 3.5.3, pristine and uncompressed is 234MB in size).
Of course, that’s still a lot if you consider that Moodle already includes its libraries, but it’s not that much if you consider that:
- it doesn’t come with more than the English language installed
- it doesn’t come with any plugin (Chamilo comes with all its plugins included in ~12MB)
- it doesn’t export to Office formats or UTF-8 PDF formats (from what I hear)
- it doesn’t come with mathematical formulas
and there are possibly a bunch of other stuff that you need plugins for, which in the end will probably generate about 800MB of additional libraries to install.
So the logic is different. In Chamilo, we want to give you all possible options in one single package, all-in-one, while other platforms probably prefer a minimalistic approach. But hey, what’s a 250MB download nowadays, or a 1GB file usage on disk? Even Raspberry Pi devices can handle those volumes easily.
Also, remember: these are not compiled programs, so you don’t need 1GB of RAM to run one instance. It’s delicately loaded-as-needed through autoloader mechanisms, so those 800MB you don’t always use are practically never filling your memory up.