12 karma · joined Mar 15, 2022 (4y ago) · 18 submissions
comment 4y ago · link · parent
Additionally, taking this scaled t-shirt app approach as a template can you share any insight into how a more complicated platform (eg Youtube, Amazon) would further leverage such in-house/3rd party services to most efficiently use their resources (ie at the fully mature platform stage)?
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
As for the homework...
naive answer: constantly update every T shirt app instance with a record of the current stock, as every transaction completes, and then make sure the system all agrees before allowing additional transactions. Sort of like a really inefficient internal distributed ledger.
horizontial/vertical scale agnostic answer: split the stock tracking into two separate services. One that is focused on managing transactions/maintains the number of T shirts (presumably a hash table for different types of T-shirts with their quantities), the other being updated every time that inventory table changes. The first service can probably be further decomposed into constituent services but for now we'll keep it simpler as a single big one. At page load time the app instance can send a GET (or equiv) request to the secondary service to get quantities of all the shirts on a given page (using matching item ID/hashes) that is then cached in something like localStorage, with ones in limited supply or out of stock denoted as such by the browser/app on render. On a transaction completion you send an update request to the primary stock service, which then begins its process of updating the table/passing the updated table to service two. This will allow customers to add products to their cart with a much lower chance of finding out some are out of stock at check out, but also (hopefully) keeps the stock tracking footprint lower than something like a constantly polling no-matter-what or monolithic tracking system.
Given the bottlenecks I can already see with the checkout transaction part, I'm actually extra curious how to improve it, so I hope you'll share what the exemplar solution would be!
comment 4y ago · link · parent
comment 4y ago · link · parent
As for sharing, while it's very generous of you to offer access and I'm certainly interested in using it once it gets a public launch, I'm much more in pursuit of the thinking behind system design choices and better developing the intuition that makes those choices. Honestly the framework you're putting together sounds like it could help a lot of people with similar problems to me though :D
comment 4y ago · link · parent
The generalizable advice about data co-location/data sharding is definitely something I will keep in mind (if this weird learner project really involves data in such quantities) however, thanks!
comment 4y ago · link · parent
comment 4y ago · link · parent
All of this is entirely fair and worth considering, given pretty much all mature frameworks do tend to have some extension or build out option to make them "scalable" as far as I can tell. Now to choose one that's not Django, which I've heard is a bit of a nightmare for this sort of building out (but maybe more because of the problems you mentioned than anything wrong with the framework itself?)
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
Given it doesn't sound like you're gonna share the info about scalable infrastructure, could you possibly provide some guides or extra reading for the patterns and practices one should be going with at the the small and feisty stage? I might as well take some notes down about this side of things if you have materials that speak to it.
comment 4y ago · link · parent
To be clear I am not trying to create a business, I'm wondering what the ecosystem of best practices, tools, and frameworks to solve an open ended problem like this is so I can try them out before trying to build a real one (which I think you're right, would require an actual business to justify its existence) For example: could you elaborate on some possible benchmarks to try reimplementing, to this end?
18.
Ask HN: How would you, a solo dev/small team, make a scalable web app in 2022?
15 points · by star_juice · 4y ago · 35 comments