Ask HN: What is best way to do hands-on practice for system design?

222 points by maheshs ↗ HN
I have build many small size web apps.

I lack experience in designing medium to large application. I tried to read system design content but not able to gain confidence.

How can I do the hands-on practice of system design concepts. Please your tips, resources, plan etc.

97 comments

[ 2.4 ms ] story [ 182 ms ] thread
I think practicing design is difficult because of one major issue: how will you know if you got it right? I think the only way is to actually implement the design, and learn what works and what doesn't (and, crucially, why).

It's essentially an apprenticeship: you work in teams and as you gain experience, you contribute progressively more and bigger ideas. One day, you get a job where the design is your responsibility.

Build a system. That's how you learn.
Yeah. Video games are very good at getting you to do this, and for teaching systems thinking.

Not directly related to any specific type of system, of course, but very good at getting you to build a system, maintain it, and fix any issues with it.

Factorio is an obvious example.

First, it is very hard and there is no such thing as a set of perfect answers for every situation. So, relax and try to have fun while you learn - you might be right, you might be wrong and so is every other developer. L

Second, I think the best way to learn is to just work on a lot of systems. Sometimes your ideas will work out. Other times, you will wish you had become anything other than a software developer. Both states are equally helpful. It’s nice to write good software and have things work out. But you’ll learn a lot more from the projects you can only fix with ‘rm -rf’.

Third, try to get as wide a range of experience as possible. Be the lead designer on one project. And be extremely junior on another project. You’ll learn as much from implementing another person’s designs as you will learn from implementing you own.

And finally, have fun and be cool to everyone you work with. You will meet a lot of beautiful people and a lot of assholes. But if you love writing software, you’re part of the tribe. Make it positive and be cool to others. In twenty years, you won’t remember half of what you know now. But you will always remember developers who were kind to you when you were learning. Be one of those memorable developers…:)

Good luck. It’s a hard path but I know you can do it. You’ve proven it by starting off here.

You get hands on experience at a place

1. That has a functioning app

AND

2. Business is growing rapidly bringing more customers than the system can handle.

In other words you learn on the job by getting your hands burnt. I got lucky to have joined such a startup. Learnt a lot, from fixing DB queries, designing asynchronous order processor, using CDN etc. I worked on scaling up the full stack including stuff like connection pools.

So your best bet is to join such a startup. You will learn a lot by handling real user traffic. And also scaling isn’t homogeneous. For example, you make different trade offs scaling a search application Vs scaling a payment processor. So business use case and business domain does matter.

To add something further to this excellent comment:

Join a start up with a legacy code base, e.g. dodgy old PHP that they’re pulling out into modern domain services.

Within a year you’ll be able to analyse performance and scalability issues and refactor them in your sleep.

If you want to build your skills, sure go ahead.

But working at a company like this is not a good way to build your wealth. You're far better off working at a big tech company that has awesome benefits or a fresh startup. Startups that have been around long enough to have a legacy code base aren't a place to become wealthy.

Not everyone aims to be wealthy. Most companies do pay a decent salary (specially in europe) with good work life balance. High paying jobs often correlates with high stakes which means potentially higher level of stress.
I don’t think the high paying job = big stress correlation is as strong as you might think. Sure a few places are known for bad work life balance but (especially if you are employed in Europe) I would guess many big companies offer better WLB than startups - in fact, I’m sure the pace might be “too slow” compared to smaller companies in many teams.

There are plenty of valid reasons to not want to work at big tech co’s, but if you’re discounting it for expected stress level alone I’d do a bit more research as I don’t think it’s as true as you think. Obviously read reviews of Glassdoor/Blind to get a sense of the company you’re applying to…

> But working at a company like this is not a good way to build your wealth

Common software engineering mistake: focusing on solving the wrong problem.

OP wants to practice hand-on system design. OP never writes about "building wealth" and doesn't even mention money anywhere. So where do you get that this is about building wealth?

Not necessarily, the biggest most rapidly growing project I was with only taught me anti-patterns, but I guess that's something you need to learn too ...
I've got my hands burning over the last 12 years in 4-5 places like that.

From web & app, frontend, to backend, databases and server management.

Yet I still find it hard to grasp good system design.

At best I prefer things to be as simple and clear as possible, that's about all I'm certain off.

Most systems are already so established if they get going, you are mostly patching. Once you start patching all effeciency goes out the window, especially if those who build v1 are gone. Hard, and most often a bad idea, to overhaul a system to something more stable & efficient.

Now that I think of it, probably my biggest learnings are what not to do, not what to do.

> you learn on the job by getting your hands burnt.

That's how it works in new fields where there's no good theorical foundations yet. I think OP is asking if we already know how to avoid getting hands burnt in the first place, as in many other fields of engineering where you don't just learn on the job and get yourself burnt a few times.

This is why I think "software engineering" is more of a creative field than a "hard engineering" one. More akin to painting or singing. You need practice in order to improve solving problems in the real-world, you can't just read up on it and become better than people who've actually implemented useful things in real scenarios.
I think that in the area of system reliability, specifically, there's quite a lot of theory that's useful and often ignored by practitioners, though. Saying you need to learn everything on the job is akin to cowboy system design. There's a lot of collective knowledge you should absolutely use when designing large systems, and ignoring that body of knowledge by assuming the only way is learning on the job is a mistake.

I believe not long ago, medicine was like that. Clearly, things can, and should, become more standardized and that will not in any way encumber the creativity that is also a big part of our field.

This only works if you work someplace that has complicated problems and/or architecture astronauts who like to overcomplicate everything. Every small, mid and even most large-scale tech shops are able to execute on goals using off the shelf software. How do we scale payments at my org? We pay Stripe. How do we scale search? We pay Alogolia. How do we scale our public facing web sites? We pay Amazon. I've been in architects/director roles at multiple orgs for over ten years and everything they ask at FAANG system design interviews is still stuff I've only read about.
Here are some tips which most of distributed systems follow :

1. Almost all distributed systems has a global load balancer sitting in front, which will distribute your traffic to nearest possible server.

2. Decide how do you want to make your DB replication to happen. Is it active/active, active/passive, P2P, etc ?

3. What do you choose between Consistency and Availability when Network Partition happen? Some databases like Cassandra are eventual consistent.

4. Any asynchronous tasks will need to use queuing service.

5. Any performant API will need to use Caching and CDN.

Hmm. I think you might be getting at two different questions.

One: How do you get better at systems design? Build stuff -- lots of stuff. If you're interested in designing particular kinds of systems (say, planet-scale web services...), then get a job at a company that does that kind of thing.

Two: How do you get better at systems design interviews? That's much easier; you can just throw money at the problem. Use one of those paid mock-interviewing platforms where you can hire FAANG interviewers to anonymously interview you and give you feedback.

I just went through this interview prep and got the offers I wanted, so I can offer you a data point. It took me < 20 mock interviews (total cost of < $10K) to go from "I have no idea what I'm doing" to "I'm not worried about this part of the on-site interview loop." Admittedly, I have a decent bit of experience architecting systems at scale, so I was mostly using this approach to refresh my memory (heading back to a Big Tech job after several years of retirement) and get familiar with the interview format.

There are some common resources recommended for this sort of thing if you want to also make sure you've read the right content. The most helpful resources for me were the DDIA book [1] and the "Systems Design Interview" YouTube channel [2]. Both are great for breadth and getting exposure to a ton of different concepts -- after that, you can follow your nose (or the book's bibliography) to get depth on whatever you're most interested in.

Good luck with it! It's a deep and really fun rabbit hole. I suggest you find a particular type of system that you're really interested in; start pulling on that thread, and you'll inevitably find your way to all kinds of other fascinating systems-design topics as you go.

[1]: https://www.amazon.com/gp/product/1449373321/

[2]: https://www.youtube.com/c/SystemDesignInterview

Big plus-one for the Systems Design Interview channel. I learned a lot from watching those videos (repeatedly) when I was preparing.
> It took me < 20 mock interviews (total cost of < $10K)

That's a lot of money!

A pretty good ROI, if I had to guess?
(comment deleted)
(comment deleted)
(comment deleted)
Most people can't casually throw away 10k to get better at interviewing...

I'd say for us non-wealthy mortals, the best approach is to find another engineer who will conduct mocks for you. Short of that, maybe do one or two paid mocks to calibrate yourself, then practice on your own.

The sad fact is the "system design interview" is not really like actual system design at all. It's more about following a specific format that everyone expects and knowing the ideal solution up front.

Maybe on my experiens,I learn the system design by think about how to build the system or software in our life ,just like how to build a Uber or an Amazon. If you feel like it's a little hard to do, just try some simple things like a lift or a parking.

As you said ,you have a lot of small apps, mabey you could do something to link them together, and build a middle layer service for all the apps. In this progress, you should consider all the part of designing a distrubuted system, it could help you a lot, I guess.

Perhaps it's not the best way to improve the ablity for system design, it works a lot on me at least.

Don't underestimate how much what you can learn building small apps will scale up to bigger ones.

The great thing about smaller projects is that you can take risks with them.

Build something small that uses a message queue. Then do a project that integrates with some web APIs. Then try building something that implements GraphQL. Then try integrating full text search.

When you get the chance to work on something bigger I guarantee you'll find this experience incredibly valuable. Larger systems tend to look a lot like smaller systems, but messier and more complicated because more people have been involved in helping grow them as their requirements have changed over time.

Build apps and play Zachtronics games
I started a blog to explore this idea! I've built Pokemon Games to learn how to do things on a large scale. I've done Kubernetes, Redis Caching, nearly every flavor of Database (NoSQL, SQL, Graph, etc), and microservices, monoliths, you name it.

I'm going to be exploring how to go about it, how to massively over-engineer things for the sake of learning, as well as build minimalistic aspects of the games.

There will be `Main Quests` where we build a simple game, and `Side Quests` where we go off the wall and explore new tech.

I just started tonight! So it's definitely a WIP

https://mikercampbell.gitbook.io/gotta-code-them-all/

Hey, just created an account on HN just to say that I love the idea of your project. It rekindled my interest to learn Typescript and the premise of doing a smaller scale pokemon game just seems incredibly interesting and infinitely extendable. I blazed through the first few chapters and am desperate for more. I understand what the next steps should be, but I struggle to put them into non spaghetti code and would love to see your more modular approach on it. Really hope you keep going, this is so fun!
YES! This made my day! I've never screenshoted a HN comment before, but I had to keep this one and hold onto it. This really got me excited!

I'm currently working on the Caching (both in memory and with Redis as an option), how to generate Pokemon with random or specific values (like NPC teams need to have hard coded moves and levels, but you want random encounters to have random data) as well as the building the Overworld, with basic keyboard controls, collision detection, and beginning to have an ECS from scratch.

I'd love it if you would alpha test my next chapter? And please provide any feedback. Let me know where I'm too verbose, or if the code isn't clear or doesn't work for you!

Sounds awesome, would love to test it! Exciting topics coming up!

I added an email to my profile where you can contact me

Practical ideas off the top off my head:

Take a fast moving input data stream, and map it to some slower moving output streams.

Use a message queue, a web tier, a worker, and implement private and public caching internally in something like Redis. Implement HTTP caching.

Implement backups, failover, and recovery. Create runbooks and checklists.

Secure everything with MFA auth for admin-type users and design and implement lesser privileged user access.

Design and implement RBAC.

Add reporting, logging, fault-tolerance.

Make it platform agnostic and support multi-tenancy, i18n, and WCAG.

Support and test for HIPAA and GDPR compliance.

Document the whole thing.

Figure out how to write automated tests for all of these aspects.

I know this isn't really what you asked, but I've administered hundreds of software engineer interviews, and there are two very common mistakes I see when it comes to system design:

1. Not clarifying the problem. The very first thing out of your mouth should be a series of questions that helps you define the requirements more clearly. Identify use cases. Try to understand the scale; questions that start with "how many" are good ones.

2. Not being concrete. For example, I had a design problem I'd give people that usually wound up with them sending lots and lots of messages in real-time from one system to another. But when pressed, very few people were able to describe the contents of those messages in any detail.

Just thought I'd pass that along in case it's helpful to you. And I'll second what a lot of other folks here are saying: the best way to learn this is to get experience.

And I would add :

3. Not being specific about any technologies. Instead of using a "SQL Database" and a "cache", just say "PostgreSQL" and "Redis". It's an interview, if you're not specific, I will start thinking you don't have any experience with Redis or Postgres. If you really don't have any, I will find out anyway.

I would think it doesn’t matter? Whether we use redis, memcached or anything else is irrelevant to the point, which is that you want ‘something’ to function as a cache.
I would advise against it. Two reasons: - if the person interviewing you know the specific tech you picked, you give them an opening to control the interview. They can go anywhere they want and you would likely fall short unless you know the stack in&out

- when you pick specific technology, you also have to defend why this one specifically. For ex, why redis and not memcache or why only postgres and not redshift..

If you keep it at sql and no-sql, you can easily defend the answer and control the interview

I would also advise against it. At this level i would expect the more abstractive way of thinking. I don't see a reason to go so much in detail right now. Model > tools.
As an interviewer I ding people who don’t understand the underlying capabilities. They often matter!

Like if the design depends on modifying two keys atomically, a transaction is required. Some KV stores have that ability, some don’t. Do you need the keys to be in the same shard now? What kind of persistence is required here?

Redis and Memcache are quite different where the rubber meets the road. Gotta know what you’re talking about, don’t handwave over the details.

Great point. It's also hazardous if your interviewer does NOT know the specific tech you suggest. They may reject it with "Sounds suspicious, if that's any good why haven't I heard of it?"
I interviewed someone who put an Amazon AWS product in every box on their design and was unable to explain how each would solve a particular problem except "Amazon product X solves this for us". No abstract thinking.

Strong no.

All these differing opinions on this tells me interviews are a crapshoot subject to the interviewer's whims. If I got you for an interviewer I would need to be specific, for others who replied to this, I'd need to be generic. Hopefully the interviewer is helpful in this regards and indicates his preference, maybe by asking what cache would you use and why instead of silently docking me points.
From the inside, it can feel like there are actually too many rules. The interviewer is likely running a fairly narrow script. The interviewer probably believes they are being fair or generous when allowing minor deviations from their structure.

From the outside, it all feels random: unless you know the rules the interview is playing by, you can easily make a mistake. Each place has a different interview script and priorities.

I loathe secret requirements in interviews and am up-front and explicit about what I'm looking for. Even with that guardrail though, lots of folks don't answer the questions I'm asking. So I guess a more general piece of advice would be: listen to the interviewer, listen to the question, and answer the question that was asked.

(This is the same advice I give people when I'm coaching them for FAA oral exams, incidentally. People really have a hard time listening to a question and answering the actual question.)

> But when pressed, very few people were able to describe the contents of those messages in any detail.

Can you explain why this matters? It’s an architecture interview right? Not an API/Worker/Queue design exercise.

It’s not like I don’t expect someone to be eventually able to figure out the contents of the payload, I’d just not expect it to be at the forefront of their mind.

Emails with attachments vs plain text messages. Binary content. Compressed content. Size matters, especially at scale.
Ah, gotcha. We're still talking about 'what kind' of messages. Not, 'which fields', which is what I understood.
You don’t actually want that, I think. In practice systems start small, and stuff is added to them gradually. I consider this as a much bigger challenge than designing a “complex” system right from the start. The trick is to be able to keep a system clean over time, not to design it for a year and then just write down the code. So it’s fine to start with your small apps, but instead of throwing it away try to keep adding stuff to it and release more advanced versions say, every month.

That being said, there are a few well known examples of systems that are somewhat complex right from the start. Ecommerce comes to mind: build a configurable ecommerce framework that supports multiple stores, multiple vendors, multiple channels, CC and cash payments, multiple currencies, international delivery etc.

System design interviews have so far been a bit hit or miss for me. All the interviewers seem to be looking for something, but I’ll be damned if I know what it is.

I think I’m inclined to incrementally solve potential problems with the system (as introduced by the interviewer), where a lot of these interviews seem to want you to anticipate all issues.

So asking lots of questions about what they want is probably a first.

this describes my experience as well.
I know you didn’t ask for this but Me and couple of my friends at big tech who have given and taken 500+ interviews, do mock interviews for each other and references.

For reference we do paid 45 mins mock interviews. In case you are interested, dm me and I can share more details.

There’s no dm on hackernews, can you share your email or something?
I think you can even take the smallest web app and make it into a more "real world" project. Take for example the classic counter demo. Try adding these features:

* i18n/l10n: Display labels in different language and correctly format the counter value for your user (1'000 vs 1.000). A user should be able to switch country

* Allow users to register and create their own counters

* Store the counter value in database hosted somewhere

* Store content stuff (title, labels, etc.) in a headless CMS and integrate with it.

* Set up build pipelines for your project

* ...and more :)

* Make this app multi tenant.

* Make this app highly available across geographies under heavy use.

I built a homelab server using a HP Elitedesk running Proxmox. Allows me to experiment with all kinds of tools which facilitate strategies for redundancy and scaling.
Checkout highscalability.com, used to have lots of real word scalability issues and solutions back on the day.

If you want hands on experience, pick an open source app in the language you know and deploy it somewhere and load test till it breaks and see which part breaks first. It could be your load balancer can’t handle that many connections or you app server rubs out of memory or the db comes to a crawl. The more real world you can make load test queries the better.

At the very least you’ll get hands on experience.

Highscalability.com was great! I still follow their RSS feed but there's not a lot of new content nowadays. If someone knows a similar resource I'd love to hear about it!
For what purpose?

Are you a small business owner that preparing for going viral one day? Keep improving your system bit by bit. Maybe add a caching layer today, load balancer tomorrow, a job queue somewhere down the road and scale up your database now and then. And probably YAGNI imo.

If for job hunting, other comments had better suggestion

I always recommend to read the classics (in addition to other excellent advice given here). Brooks, for sure, but also Vitruvius is _very_ relevant to designing large software systems. Then jump into the MIT System* ocean: system architecture (Crawley) gives you a framework for thinking about large and complex things, system safety (Leveson) a good framework for making things safe. Add some MIT product design and a ton of failing on your arse and you should be understanding you don’t still a thing in no time at all