<?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[theAsianparent - Medium]]></title>
        <description><![CDATA[theAsianparent is the largest content &amp; community platform in Southeast Asia that helps parents in their conception, pregnancy, and parenting journey. Read our team’s essays and insights on parenting, work-life balance, and tech-driven solutions for families. - Medium]]></description>
        <link>https://medium.com/theasianparent?source=rss----2ca076b69169---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>theAsianparent - Medium</title>
            <link>https://medium.com/theasianparent?source=rss----2ca076b69169---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 08:19:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/theasianparent" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Taming the behemoth: Scaling theAsianparent Part 1]]></title>
            <link>https://medium.com/theasianparent/taming-the-behemoth-scaling-theasianparent-part-1-246390cadbd4?source=rss----2ca076b69169---4</link>
            <guid isPermaLink="false">https://medium.com/p/246390cadbd4</guid>
            <category><![CDATA[scaling-up]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Alvin Edwin Roland De Cruz]]></dc:creator>
            <pubDate>Fri, 29 Oct 2021 05:18:32 GMT</pubDate>
            <atom:updated>2021-10-08T19:54:30.271Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*gzYrkq96U0moo5i_z9vnKA.png" /></figure><p>Scaling is hard if the foundations are not built right, especially when you only have 2 days to figure out how to convert your code to handle sharding or rapidly add read-replica support to code that you wrote from scratch, two interesting experiences that I had in previous companies.</p><p>I’ve been the Head of Engineering for Tickled Media for a few years now, and identify as a full-stack engineer that has experiences spanning from running startups, managing games that span 500,000 users to day, and to theAsianparent, which has been growing at a steady rate for the past few years that I’ve been here. One of the products we added to the brand was <strong>theAsianparent Community</strong> (<a href="https://community.theasianparent.com/?lng=en">https://community.theasianparent.com</a>). We are running our infrastructure on <strong>Amazon Web Services</strong>, which I have 8 years worth of experience on, but much of that was backed up by a wonderful engineering team, and the solutions teams within AWS themselves.</p><p>The story of our new product under theAsianparent umbrella was the same as other start-ups:</p><blockquote>“Let’s grow quickly as much as we can, glue something together and hopefully it works as well as we hoped!”</blockquote><p>As the new product grew, more users signed up, and it started to become a question of “How long can this platform sustain itself before the cracks start to appear?”</p><p>Scaling is a simple concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*6QSnNJ2GBYeg7naKk5bNeA.png" /><figcaption>Resource can mean many things, by the way.</figcaption></figure><p>However, underneath that, the implementation differs depending on the infrastructure, application and budget in the money sense. There are a few considerations when it comes to implementing scalability and these 3 are the most fundamental in the order:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*L0h-RiTQvoTBpIhl3ps2sg.png" /></figure><p>This is not an exhaustive list, as we have not touched on queues, asset storage, etc. But it serves to show the main features of your platform that will need to be looked at, when it comes to implementing the foundational pillars to scalability. A degradation in one of them may not be apparent as first, but the technical debt accrued will rear its ugly face down the line, where un-optimized code will bring down the most expensive (or expansive) cluster down to its knees. For the sake of brevity, caches such as <strong>Redis</strong> and <strong>Memcache</strong> fall under databases.</p><p>In <strong>theAsianparent Community</strong>, as we got larger in our user numbers, we started to see slowdowns in certain areas of the application (both web and native apps such as iOS and Android).</p><p>We will start off with resolving issues with application code, as those can save you and your company a lot of money before considering an upgrade to your server hardware.</p><h3><strong>Code</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*haot_Z24O7l7b_SmDt_V1Q.jpeg" /></figure><p>For our platform, we use <strong>ReactJS</strong> for our frontend, and the <strong>Laravel</strong> framework as our PHP-based API. While there may be some complaints from the crowd about using a lighter framework for APIs, or <strong>Laravel’s Lumen</strong>, the options we had at the beginning was something that we can create and iterate quickly, while leveraging on the engineering team who have an extensive PHP skillset.</p><p>The code that drives your software can sometimes be overlooked. An uptake in traffic could spike up CPU loads in the application server and database, and it would be a simple mistake to assume that increasing vertical resources by upgrading the hardware would solve the issue.</p><p>From experiences on our products, we could see how much load on the application servers and database could change even from a change of 1,000 to 10,000 users when the code isn’t optimized for scale. Using APM (Application Performance Monitoring) tools such as <strong>New Relic </strong>or <strong>Datadog</strong>, can help identify functions that may be chief culprit to these issues. <strong>Blackfire.io</strong> is a useful tool in charting out the flow of your API requests, and pinpointing exactly where the bottlenecks are in an easy to follow chart.</p><p>Open-source solutions that you can use are <strong>Jaeger </strong>(though it does not profile PHP at the moment), <strong>Elasticsearch APM, </strong>and <strong>Prometheus, </strong>amongst the popular options available.</p><p>In our cases, we use <strong>Datadog</strong>, where we are able to make use of its APM features to find bottlenecks either within the code, cache, database or an external resource with an unusually high response time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opeiJTuQqdIiwMa-LIrcHQ.png" /><figcaption>Datadog’s Flame Graph helps to visually look for parts of a slow request that may be taking too much time to process</figcaption></figure><p>These are the basic points that we identified in the code that have an impact:</p><ol><li>Find potential nested loops which may be too deep, and could break the system should a certain number of users access that function repeatedly. Nested loops might not be noticeable at first, but even double nested loops that continuously chain requests can be a hazard to system resources. This can double database requests, or if there’s a dependency on an external resource such as Elasticsearch or MongoDB API, will start a chain reaction of lengthy response times over 10,000 users.</li><li>Streamline multiple API calls into one. This could be an API X fetching data from another API Y where both are connected to the same database, and API Y only exists to server that specific set of data to API X. Is your application making multiple API calls and can some of the be combined into one to save on unnecessary HTTP requests? In our situation we had APIs calling a Wordpress JSON API, which was making requests to the same database. Updating the code changed this lengthy call into one request, which lowered response times from making an additional HTTP request.</li><li>Scout for queries, especially in functions, that repeat the same request for the same set of data, but differ slightly in results. Can these queries be combined into one, thus saving 1 or 2 extra calls to the database? It may seem small, but 5 users performing the same call to 1000 users can be a huge difference in affecting the database load.</li><li>Upgrade your libraries and frameworks. In the example of PHP, there’s a signficant performance advantage of newer versions being able to handle more requests. Before doing so, do plenty of testing beforehand to ensure that your code is compatible with the latest changes. For developers who went from Python 2.7 to 3.0, they should know this pretty well.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3d_TL6OxOq5IiEUhfl95w.png" /><figcaption>The difference in performance from PHP 5.6 to 8.0 is almost double the number of requests. And yes, there are companies that still run on 5.6</figcaption></figure><p>Code optimization will always be a continuous, iterative process, by your engineering team. Check, profile and measure any changes that you make to ensure that they are actual optimizations, and not one that does reductions in specialized edge cases, or barely any improvement at all. A good way to find edge cases would be looking at a latency distribution graph, and figure out which functions should deserve time by the development team to focus on for optimizations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*zKBVrY_7l4hC1jKzgLKu9Q.png" /><figcaption>Datadog’s latency distribution graph over different percentiles</figcaption></figure><p>In the next article, we will explore scaling application servers across 2 different frameworks, and what we did to scale according to their use cases, and how they were implemented internally. Because those details, matter.</p><h3><strong>References</strong></h3><p><strong>theAsianparent Community</strong> (<a href="https://community.theasianparent.com/">https://community.theasianparent.com</a>)</p><p><strong>Datadog</strong> (<a href="https://www.datadog.com/">https://www.datadog.com</a>)</p><p><strong>New Relic</strong> (<a href="https://www.newrelic.com/">https://www.newrelic.com</a>)</p><p><strong>Blackfire</strong> (<a href="https://blackfire.io/">https://blackfire.io</a>)</p><p><strong>Kinsta PHP Benchmarks</strong> (<a href="https://kinsta.com/blog/php-benchmarks/">https://kinsta.com/blog/php-benchmarks/</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=246390cadbd4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theasianparent/taming-the-behemoth-scaling-theasianparent-part-1-246390cadbd4">Taming the behemoth: Scaling theAsianparent Part 1</a> was originally published in <a href="https://medium.com/theasianparent">theAsianparent</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>