<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bruno Macedo Pasini on Medium]]></title>
        <description><![CDATA[Stories by Bruno Macedo Pasini on Medium]]></description>
        <link>https://medium.com/@bmpasini?source=rss-bd4b5f0b6308------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wWepqX8dveWY2DGo.</url>
            <title>Stories by Bruno Macedo Pasini on Medium</title>
            <link>https://medium.com/@bmpasini?source=rss-bd4b5f0b6308------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:48:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bmpasini/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Challenges of Scaling Dynamic Systems]]></title>
            <link>https://medium.com/lifion-engineering/challenges-of-scaling-dynamic-systems-8a8058df7a94?source=rss-bd4b5f0b6308------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a8058df7a94</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Bruno Macedo Pasini]]></dc:creator>
            <pubDate>Mon, 21 Oct 2019 23:17:06 GMT</pubDate>
            <atom:updated>2020-02-07T21:33:00.923Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/924/0*3hSl9J0OIQvAj5hT" /></figure><h4><em>A reflection on compiler optimizations</em></h4><p>The Lifion platform, at its core, offers the ability to rapidly develop an HCM Application Suite that works globally. The main challenge for global enterprise software is that each country has its own set of regulations, which means there should be a slightly different behavior that provides the same capabilities for each distinct country. The fact that each business could have a different set of requirements for the same product compounds the issue, which is why building HCM Software at a global scale is so challenging.</p><p>Our platform simplifies the process of building slightly different versions of the same HCM Application Suite for all possible use cases in existence. The current system is so flexible that it is capable of creating custom application behavior at runtime, depending on the client configuration. However, if not designed carefully, this powerful feature can come at the cost of scalability.</p><p>If we look at how this problem presents itself in other areas of computer science, we can realize that this is essentially one of the first problems that had to be solved to make modern computers work at a larger scale.</p><p>Programming languages provide great flexibility for computers to do almost anything. However, the underlying computer architecture limits the set of constructs that can co-exist internally. A compiler is the program responsible for converting source code into a sequence of instructions that machines understand. The typical step of compiling source code demonstrates a fundamental concept that we should also follow, which is converting our flexible language into the required set of constructs before runtime.</p><p>In the same way that compilers convert source code into machine language, our system could also compile each different permutation of an application into a client-specific version of the product. We have enabled flexibility by allowing basic constructs to be pieced together accordingly into different configurations, depending on the country that our client is located and also in the set of functionality that they need. With this requirement, we should be able to compile a version of the product, per client, in a way that stops repetitive computation at runtime.</p><p>Several questions arose before we tried to implement the concept described above, most notably:</p><ol><li>What is the total number of platform permutations that need to be supported?</li><li>Is the projected number of required permutations too high for a feasible implementation?</li><li>Is it possible to reduce storage requirements in such a way that this can be achievable?</li></ol><p>Those are some points that we are going to tackle in this article.</p><p><strong>What happens when a page is loaded?</strong></p><p>Our metadata-driven architecture gives the flexibility to dynamically generate different versions of the same Application Suite, given the configuration of a specific client.</p><p>With that in mind, here’s a diagram of what happens when a user opens a page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RBmW1VgkyBEnwf1K" /><figcaption>Image 1: Page rendering steps</figcaption></figure><ol><li>A specific permutation of the Metadata is generated based on the user configuration.</li><li>A Metadata-Driven Engine (i.e. DSL-Engine*) transpiles Metadata into a more suitable format.</li><li>Now the application-level action can be executed based on the final format of the metadata (i.e., rendering a React.js component; or performing an SQL query).</li><li>The user is authorized based on their access levels.</li><li>The browser renders the page.</li></ol><p><em>* DSL-Engine is a system that interprets Metadata and performs an application-level action based on its contents, such as rendering a web page or running an SQL query.</em></p><p>Heavy processing has to be done for a page to render correctly, and we could do a good chunk of it preemptively. The client to which the user is assigned to determines a good portion of the user’s configuration, and we should be able to leverage that fact. We can pre-process all the metadata for a client each time their configuration changes.</p><p>A large number of users share the same parts of the page loading process, such as compiling metadata. Those parts have the potential to be pre-processed even before the user accesses the page. We need to make sure those parts are on the left side of the diagram above. Parts of the process that are specific to a single user, such as authorization, should be processed after and should occur on the right side of the diagram. If a layer on the left is regenerated, all layers to its right also have to be.</p><p>With that in mind, we should be able to break the page loading process into two portions — one that happens ahead of time (e.g., at compile-time) and another one that occurs at runtime. A runtime portion will always exist as the sheer number of different possible permutations makes processing it at compile-time not feasible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ic2NwcZjDzf0326f" /><figcaption>Image 2: Page rendering after optimizations</figcaption></figure><p>Each time a client configuration changes, we can:</p><ol><li>Generate all necessary metadata for that configuration.</li><li>Transform metadata into the format that makes more sense for DSL Engines.</li><li>Convert the resulting metadata into code that is ready to be run.</li></ol><p>The resulting code becomes quickly retrievable, increasing the runtime performance dramatically while reducing the number of required steps to render the page, which are:</p><ol><li>Retrieve precompiled code.</li><li>Process application according to user-level configuration.</li><li>Authorize the user.</li><li>Render the page.</li></ol><p>The runtime steps change so frequently that it is not worth doing them ahead of time. Our systems would need to generate an extreme number of permutations that are both short-lived and only serves a small slice of users. As a result, the cost of maintaining them outweighs any benefits.</p><p>It is crucial to keep a balance between what our system processes in advance versus what it does not. If we find the right balance, we not only increase runtime performance but also improve scalability, reliability, and cost savings. We avoid redundant parallel processing, runtime engines have far less complexity, and fewer operations are prone to failure at runtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/0*mUBoi4M6-m39w4vP" /><figcaption>Image 3: DSL Engine layers</figcaption></figure><p><strong>Implementation Challenges</strong></p><p>To evaluate the complexity of the above concepts, we had to introspect into our data, which helped us answer questions such as:</p><ol><li>How much data our system needs to pre-generate for each client?</li><li>How does that data grow over time?</li><li>Is it possible to optimize data storage?</li></ol><p>The data generated for each client depends on the number of applications they have purchased. An application is a small unit of metadata that represents the functionality of the HCM Application Suite. Each client has a different configuration of those application, depending on the functionality they have purchased.</p><p>We analyzed data for ten clients to understand their differences, and here’s what we found:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/0*VJGKFu6N6bd-nL1i" /><figcaption>Image 4: Number of applications purchased per client</figcaption></figure><p>There’s a considerable amount of shared functionality among clients.</p><p>There is a particular type of metadata that is responsible for the different permutations that a client can have, based on their localization and their application configuration. We call that type of metadata “override.” The graph below shows how much of the metadata used by those clients is composed of overrides:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/0*RP8gRCJAdkCTc2xn" /><figcaption>Image 5: Percentage of override documents per client</figcaption></figure><p>There is not a large number of metadata permutations within clients — at least not at the current stage of our products and of our client’s configurations (in terms of functionality purchased and enabled).</p><p>So far, we know that clients may share the same functionality, so most of the existing compiled metadata may be composed of duplicated documents. Here’s how metadata grows, if we don’t deduplicate it (assuming only one configuration per client):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ppQm9H8ic3eWUTk4" /><figcaption>Image 6: Storage size growth with duplication</figcaption></figure><p>Each client needs roughly 300 MB of metadata for each distinct configuration they may have, which means that our data will grow linearly for each use case. But can we do better? How can we deduplicate this data?</p><p><strong>Location-addressed storage vs. Content-addressed storage and Merkle Trees</strong></p><p>The reason why there’s data duplication is because we store it using a location-addressed approach. The key to deduplicating data is to make sure not to store data that has the same contents of other documents in the database, which naturally happens if using location-addressed storage. Instead of using the data location as storage key (e.g., clientId), we could use the contents of the documents to form their keys and store their location information somewhere else.</p><p>We can represent the contents of metadata by its hash. A potential problem with this approach is that calculating the hash of large documents can be expensive, and sometimes metadata documents can become quite large. For this, we can leverage Merkle Trees. When application developers build metadata, they work on separate views of the metadata at a time. When the developer saves that view, our system computes a hash of the contents of that metadata and uses it to form their storage key. Compiled metadata is a composition of the different metadata views created by the developers. Thus, our system can concatenate the hash of those smaller documents and re-hash it, instead of computing it every time it compiles a large metadata document. A very similar approach to Merkle Trees, except that in this case, each node in the tree only has one child. Yet, a linked list is just one type of tree, so the concept is the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*RW909jyTi1CSNIYe" /><figcaption>Image 7: <em>Location-addressed storage (with duplication)</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R6iaY-2j2biTrBlK" /><figcaption><em>Image 8: Content-addressed storage (with deduplication)</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5wBgtwFeAXC6XNTY" /><figcaption>Image 9: <em>Merkle Tree hashing approach</em></figcaption></figure><p>Here’s the difference in data growth when following the optimized approach:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gjBqBxIxfQzaiISa" /><figcaption>Image 10: Storage size growth with deduplication</figcaption></figure><p>The data growth went from linear O(n) to almost logarithmic O(log(n)). Speed was greatly optimized, as well. We now only need to compute the hash value, instead of a full repetitive re-compilation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/0*07H2cQKt3yA7SmL9" /><figcaption>Image 11: Storage size per client with deduplication</figcaption></figure><p>After the 7th client, all of their metadata were duplicates of previously compiled metadata. The only data created for each new client were keys pointing to the already existing metadata.</p><p><strong>Conclusion</strong></p><p>The metadata-driven approach of Lifion’s Development Platform gives ADP the flexibility to quickly develop global HCM Applications to their clients. That flexibility comes at the cost of high processing needs for generating highly customized versions of the same HCM Application Suite of each new client. If our systems always have to build the application at runtime, it will be difficult to scale the platform to support millions of users.</p><p>There are ways to determine what part of the processing we could do in advance, and how to save computational resources. So far, we have solved the problem for the metadata that we generate, and the next challenge is applying the same approach for pre-generating the code tailored to our clients’ needs.</p><p>It was exciting and rewarding to discover that storage needs could be reduced from linear to logarithmic growth by stopping the storage of duplicate documents in our databases. Sound engineering principles are crucial to globally scaling our platform in a way that is cost-efficient, resilient, and performant. We are very excited to lead the engineering effort of delivering a seamless experience to millions of HCM software consumers across the globe!</p><p><strong>Credited Team Members</strong></p><ol><li>Srdjan Strbanovic (Sr. Platform Architect)</li><li>Igor Kurochkin (Engineering Manager)</li><li>Jude Murphy (Solutions Architect)</li><li>Ali Yousuf (Software Engineer)</li><li>Alex Vũ Nguyễn (Software Engineer)</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a8058df7a94" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lifion-engineering/challenges-of-scaling-dynamic-systems-8a8058df7a94">Challenges of Scaling Dynamic Systems</a> was originally published in <a href="https://medium.com/lifion-engineering">Lifion Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>