App Scalability: Avoiding Worst Case Scenarios
April 22, 2021
A Tale of Too Much Traffic: The Heavy Textbook and the Ping Pandemonium
Once upon a school day, our engineering team noticed something…peculiar. One of Clarity’s clients, the Math Learning Center (MLC), was seeing a sudden and dramatic increase in demand for their Digital Display Materials app. But there was no promotion, event, or other reason that could have spurred the app’s sudden and spectacular popularity. A software engineer probed for answers and isolated the source of all this traffic: a classroom teacher had unwittingly jammed a key on her keyboard with a heavy textbook, sending request after request to the app server. Mystery solved!
Planning for Demand
Making sure websites and apps can scale for traffic surges often comes at the cost of complex hosting architectures that are expensive to build and maintain. But if you combine the right technology with the right use cases, one can easily accommodate huge traffic spikes—even unexpected ones—without much complexity and overhead. We knew from the onset we should architect the MLC apps on a scalable platform and chose AWS Lambda for this reason. Doing so helped their apps survive pandemic-driven demand starting in March, 2020; a year later, the apps were getting 250,000 views daily—an increase of over 1200%—as shown in this chart of the MLC’s app analytics:
Expecting the Exponential
Although the increase in traffic was undoubtedly driven by an increased need for remote and hybrid learning solutions in early 2020, the heavier usage also stemmed from new capabilities launched within the apps in roughly the same timeframe: in late 2019 and through 2020, we worked with the MLC to provide their app users the option to share their math creations with teachers or peers.
Sharing work also requires saving it, and together, functionality like this can pose considerable challenges to server load because it’s storage intensive. Also, the MLC provides their apps freely as part of their non-profit mission, so we knew to design sharing functions that don’t require logins or third-party system integrations and still enable everyone to save and share work. The ease, simplicity, and availability of these apps for classroom use has driven their popularity, which in turn drives the need for the technology infrastructure to handle more traffic.
Let’s say, for example, that a student uses the Pattern Shapes app to make a design, and then—once finished—they share their work. Whenever they share, they are essentially saving a configuration file of what’s represented on their individual device screen, whether that’s made up of shapes, text, or hand-drawn elements. The MLC apps stores those saved configuration files on Amazon S3 scalable storage infrastructure.
Projecting for Growth, Pragmatically
To anticipate ongoing costs of the MLC’s new apps, we examined usage patterns and projected usage over time. We evaluated the size of a typical saved configuration file to come up with a model to forecast server load and the MLC’s service costs over time.
While our foresight did not include predicting the COVID-19 pandemic, our engineering did account for the possibility of such sudden growth. Scalability means making sure a solution can handle the random fluctuations of demand and always be available when users need it. It’s one of the “beneath the surface” components of a successful learning tool, even if it’s one a classroom user never notices.