โโ๏ธ๐ต๐ฐThe codename of the Pakistani operation: 'Bunyan Al-Marsoos' ('The Solid Ranks)
'Indeed, Allah loves those who fight in His cause, in solid ranks, as if they were one concrete structure
#OperationBunyanAlMarsoos
BeraTrax Beta is now live!
Seamlessly deposit into berachainโs highest earning protocols (mobile app thoon) ๐ฒ
Earn BTX points while you can. Beta only till Dec 31st (limited to only the most degenerate beras)!
By analyzing data access patterns, they identified that most user-generated content was infrequently accessed after 15 days of creation. They were using S3 Standard-IA, which has a cost of $0.0125/GB and is used for long-lived but infrequently accessed data that needs millisecond access time. ๐
In Nov 2021, AWS launched another storage class, S3 Glacier Instant Retrieval, with an even lower price of $0.004/GB for long-lived archive data accessed once a quarter at the same speed. ๐
After comparing their data access patterns, almost 90% of the data was fit for S3 Glacier Instant Retrieval. So moving all data to the new class should save them millions, right? Not so easy! โ๏ธ
There is a one-time fee for moving objects between different storage classes based on the number of objects you move, which could result in around $6 million to move the data to the Glacier class. There is also a minimum billable size for S3 Glacier, which is 128KB, so if your object is less than that, you will still be charged the same as 128 KB. So they needed to find a sweet spot between the initial data transfer fee and ongoing storage cost. Based on their analysis, transitioning objects of size 400KB or more was supposed to give them a good return after 6 months. They also found that objects with a size of 20KB were more cost-effective to just leave in the S3 Standard IA. ๐ป๐
With this transition, Canva was able to save $300,000 per month or $3.6 million annually. ๐ฐ๐
Key takeaways:
1๏ธโฃ Analyze Data Access Patterns: Understand how frequently your data is accessed to make informed storage decisions.
2๏ธโฃ Choose the Right Storage Class: S3 Glacier Instant Retrieval offers a cost-effective solution for infrequently accessed data.
3๏ธโฃ Invest for Long-Term ROI: The initial migration costs were quickly offset by substantial ongoing savings.
Continuing from my last post about making app state shareable by saving it in the URL, I created a custom React hook that simplifies this process, I am sharing it here, might be useful for someone.
This hook, ๐๐๐ฒ๐ฆ๐๐ฎ๐๐ฒ๐ช๐ถ๐๐ต๐ฆ๐ฒ๐ฎ๐ฟ๐ฐ๐ต๐ฃ๐ฎ๐ฟ๐ฎ๐บ, manages a state value and keeps it synchronized with a URL search parameter. This way, your app's state is always reflected in the URL, making sharing and revisiting specific app states easy.
Link to the code snippet is in the threadโฌ๏ธ
#ReactJS #CustomHooks #WebDevelopment #StateManagement #ShareableURLs #JavaScriptTips #FrontendDev #ReactTips #WebDev #CodingBestPractices
โ๏ธ Make Your App's State Shareable: Save It in the URL
When building an internal react state in your web app, a crucial question to ask yourself is:
"๐๐ณ ๐ ๐๐ต๐ฎ๐ฟ๐ฒ ๐๐ต๐ถ๐ ๐จ๐ฅ๐ ๐๐ถ๐๐ต ๐๐ผ๐บ๐ฒ๐ผ๐ป๐ฒ ๐ฒ๐น๐๐ฒ, ๐๐ถ๐น๐น ๐๐ต๐ฒ๐ ๐๐ฒ๐ฒ ๐๐ต๐ฎ๐ ๐โ๐บ ๐๐ฒ๐ฒ๐ถ๐ป๐ด?"
If the answer is no, itโs time to rethink how you manage the state. Often, states like search filters, pagination, or selected items are kept in Reactโs internal state, making it impossible to share specific app locations with others. To solve this, you can save this state in the URL, making your appโs location fully shareable.
Have a look at the sample code below. Now, when you share the URL, the recipient will see the filtered search results, just as you do.
#ReactTips #WebDevelopment #ShareableLinks #StateManagement #URLParams #FrontendDevelopment #JavaScript #ReactJS #WebDevTips #CodingBestPractices
๐กUnify Related State in React for Cleaner Code
When managing state in React, it's common to create separate useState hooks for each piece of related data, while this approach works, it quickly becomes cumbersome as the number of state variables increases.
โกA Better Approach: Unify State
Instead of using multiple useState hooks, combine related data into a single state object
This simplifies state management and makes your code cleaner.
#cleancode #react #codingtips #codereadability #reactstate