Analyzing a real time scenario based on my last post

With the lok sabha election 2024 counting day upcoming thought about a developer challenge to make the result leaderboards much faster with some unconventional methods. As in my previous post here a few additional crooked methods have been suggested. Lets analyze the case and assumptions.

Consider the above shown JSON structure. I had selected the Thiruvananthapuram constituency for an evaluation purpose. With the 12 candidates, details in the above format in an array structure with ‘application/json’ content header, the single transfer would use 751 bytes. As per my suggestion, consider the static properties, in the above structure are first three properties which can be predefined into a linked js file and all party symbols combined into a single gif with css sprites refering to the “party” property in a css tag. The server response need only contain a string of comma delimted count values with the sort order same as in the linked master file . On the client side split strin using delimiter and make sure the length matches the count of candidates, and recreate an array of objects utilizing iterators in javascript then apply the updates to the display. Now such an optimized response with header text/plain came to 34 bytes.

Again continuing with the Trivandrum constituency, with estimated population of 29,84,000 and assumption that 8% would be interested in such a leaderboard, the following calculations are made. See the screen shot of a Google sheet calculation.

These are assumptions based on the number of candidates and candidate name length so for other constituencies this can vary but still with a network traffic reduction of 4590 GB the bandwidth would be available to serve more users for the leaderboard. And users would be satisfied with the performance and reduced latency.

I am aware that the above table does not reflect a full costing of the system. But the scope of this post is to discuss the savings on the counting day leaderboards for a said constituency with suggested changes in the data output. Other factors like data warehousing or data storage is not considered because those are common for the conventional format of using JSON also.

But for a technical Architect suggestion, such instant response system should use AWS DynamoDB for primary storage, DynamoDB Streams to replicate changes on the stored data into Memcached JSON stores utilizing custom lambda ETL for leaderboards API consumption.

Comments and suggestions are welcomed.


Leave a comment

Design a site like this with WordPress.com
Get started