Jekyll scalability test20 Dec 2015
At work, we were questioning about building a collaborative knowledge base with git and jekyll. For this purpose we need entities with properties and relations among them.
I was wondering if Jekyll is an appropriate instruments and how many pages could you handle Jekyll with reasonable building time of the site.
I wrote some code to randomly create mock up data for 700 people and 100 companies. Every person work for a company and companies have zero, one or more employees. We need to show this informations on company and people pages plus some properties.
With this data structure, the liquid code showing the employees of a company is something like that:
We are cycling on the people array of the page, then cycling on every page of the site in search of the name relative to the employee.
With this non-optimized solution, the building process took about 60 seconds. Launching Jekyll with
jekyll serve --incremental helps a lot, but the build does recognize the changes in the current page but doesn’t rebuild the referenced page (eg. updating the name of a person change the person page but not the company where the person is working).
I initially thought that every Front Matter data was kept in memory in the build process, but seeing the results I don’t think it anymore. I needed a more fast approach so I decidet to keep a single yml file storing data accessible by key from any page. Thus reducing the number of document that the build process need to read.
In the front matter of pages I am now storing just the id and required parameter
I am also keeping a companies.yml file containing:
Now the liquid code showing employees of a company becomes:
With this changes the site complete regenaration takes just 3 secs on a Mac Book Pro.