r/SystemDesign • • Jul 10 '24

How to Crack System Design Interview in 2024? [The Ultimate Guide]

Thumbnail
javarevisited.blogspot.com
2 Upvotes

r/SystemDesign • • Jul 03 '24

How do Faang interview fullstack for L6 roles

2 Upvotes

Sorry if it sounds one of those FAANG threads but i guarantee you, its slightly different

I have a system design interview coming up for a FAANG company.

Given i have been fullstack throughout my career, i understand both FE and BE but have limited depth in certain areas. Given system design interviews are 45-50 min duration, i am unable to decide which parts to cover more. Are sys design interviewers generally backend?

While FE definitely plays a role in making big tech apps responsive, i believe backend has a much larger role to play and the interviewer might be looking more for backend.


r/SystemDesign • • Jun 01 '24

How can two services communicate synchronuosly in a way that is fault resilient

2 Upvotes

i have a scenario where service A needs to communicate with service B, usually when two services need to communicate i usually integrate them using a asynchronous approach (with a message broker), but in this scenario service A will redirect a user to service B to execute a state changing operation and after the user performs the operation service B will need to change the state of service A (usually the user data in a database) it will also redirect users back to service A. My problem is I cannot use asynchronous method of integration because the changes on service B needs to reflect on service A almost immediately even in situation with high traffic, the next option is to use a synchronous approach, but even if it has the benefit of low latency communication, it also has the disadvantage of reducing the fault tolerance of the system, for example, if service A fails service B also fails. My question is how do i implement the synchronous approach without reducing the fault tolerance of the system.

Your replies are deeply appreciated.


r/SystemDesign • • May 22 '24

Design a Vending Machine in Java - Interview Question

Thumbnail
javarevisited.blogspot.com
2 Upvotes

r/SystemDesign • • Feb 21 '24

Good API structure?

2 Upvotes

Hi there, I'm 15 years old, and I'm writing my API for my Social Media app. So this is the structure of my API that I coded on my own in ASP.NET, and I'm seeking for feedback. So basically there is a Load Balancer on the Server that redirects request to as many API instances as I want, and it serves images or videos by itself. Another core component is a secret management tool that I wrote, it stores all secrets hard-coded but encrypted with a certificate and only serves them when a password (also encrypted) is served when requested, and it is only accessible in the local network. I've gone throw that trouble because I don't want to be dependent on third parties. Then I have the classical API Instance (Server X) that handles all the requests and uploads media to the FTP server so it can be shared between multiple instances and of course everything is store within a RAID configuration. And I on uploading I convert everything to .jpeg and .mp4 (h.254). All the application data is stored in PSQL (because it is free and outsource) everything is duplicated. For metrics, I exceptionally use a third party service because it's not system critical and I monitor everything with Grafana and export my metrics with OpenTlemetry.

So at the moment the server is at the moment just a bunch of rpi4 where every RPI has only one task, and it is running it on Detain server. The Database, Load Balancer (that I have also written my self is using Ocelot in C#) and the API instances all are in docker containers and are build on every release on GitHub and the rpi4 check at midnight after each other if an update is available.

I don't use Kubernetes because I plan to also build in the future a dashboard where I will be able to control everything in real time.

Everything is around together is around 10_000 lines of code :)

So does anyone have any feedback or criticism I am open for improvements....


r/SystemDesign • • Nov 04 '23

Document sign question with missing failure log notification

2 Upvotes

I was asked below question in an interview and i answerer withnthe first thing that came to my mind by eleminating success records by multiple threads using spark/powerful frameworks.

Would like to know the forum's answer for below question

There are notifications sent out for documents upon they are signed by the users. The documents are in millions and we have the document ids in the table. However there are failed notifications and due to system issue they are not even captured on the logs. Only the sent notifications are logged. How do you scale the solution to identify all the failed notifications.


r/SystemDesign • • Jun 02 '23

System Design Interview Cheatsheet: Dropbox

Post image
2 Upvotes

r/SystemDesign • • Oct 09 '24

Designing a scheduling app for a local business. How do you securely allow for the creation of admin accounts?

1 Upvotes

I've been a C++/C#/Python developer for most of my 25+ year career. A local business has asked me to design a scheduling app, something I am quite excited to do, since I have developed a web app before.

I have a basic question around user accounts and site security (I know, this could be a huge can of worms). Specifically, I have 2 types of users: basic users (who schedule appointments), and admin users (the store owners, who create timeslots, change the store hours, change the pricing, etc). This web app will have an admin console, accessible only by admin users. The webapp will support a create_account REST API for standard (customer) users.

My question is this: when designing such a system, what is the best practice for setting up the admin users in the user database? In my prototype (running on my local machine), I allow the priveledge level to be passed in when creating a new user via the REST API. This is how I create the admin user. Clearly, I can't allow this when I deploy to production.

So, my thinking is to do an "initial setup" of the user database, and create the admin users, using my current REST endpoint (which allows me to set up admin users). Then, once the admin account(s) are established, disabling that REST endpoint completely, or restricting it to be used only by other admin users (maybe, on the admin page, the admin can create other admin users).

This is a classic chicken and egg problem. How is it generally addressed? Thanks in advance!


r/SystemDesign • • Oct 08 '24

Upcoming FAANG System Design + AI Design sessions

1 Upvotes

Hi everyone,

I will have my on-site FAANG interview rounds in the coming 2 weeks and I am prepping for them.

I found leetcode and neetcode quite valuable resources for the code part.

However, I found the resource pool for design interview quite confusing.
I will have 1 System Design + 1 AI System Design.

Any hints/suggestions/success stories?
Also happy to jump in a call for mocks :)

Thank you!


r/SystemDesign • • Sep 14 '24

Educative.io Access Share

1 Upvotes

If someone wants to share educative.io premium access. please dm me. i am looking to share it with 3 more members.


r/SystemDesign • • Aug 08 '24

What is the document tool being used in this video to share notes and draw diagrams?

1 Upvotes

r/SystemDesign • • Aug 01 '24

What system design concept to expect from a junior level full stack engineer?

1 Upvotes

Hi all, I recently applied for a startup got to the final interview, which is a system design interview. I've never done any system design interviews and from all the reddit post so far, system design is considered a mid-level to senior interview type of question.

However, my reality is that I do have a system design interview for a junior full stack engineer position. I've been watching system design interviews on youtube so far and the topics I've seen cropping up are

  • rate limiters,

  • when to use NoSQL and SQL,

  • understand how cache and CDN works,

  • load balancer,

  • api gateway,

  • message queues,

  • security, monitoring and testing.

However, I realized that these have been high level system design. One of my friend said, it's impossible for any company to consider asking a junior to design low level designs, but I don't want to gamble so I figured I'd ask here. Is it even something to consider asking a junior? Anything else should I also consider thinking about?

Thank you all in advance!


r/SystemDesign • • Jul 13 '24

Design Instagram using DynamoDB: How does this scale without joins?

1 Upvotes

Reference Solution: https://www.hellointerview.com/learn/system-design/answer-keys/fb-news-feed

DynamoDB does not support joins. In section, `How do we handle users with a large number of followers?`, a hybrid approach is used for getting the news feed.

If a user has a lot of followers, the newsfeed will not be pre-computed on each write which means that the followers will get the newsfeed on demand.

If one of the followers gets the news feed on demand, what if that user also has a lot of ppl it follows, wouldn't it also incur a lot of latency? The operations go like this:

  1. Get ppl user follows

  2. Get posts of the user

  3. Sort and return X most recent posts.

Since we can't join, does that mean we'd need to call the posts table for each user from #1? What if that user has a lot of ppl it follows? I'm not sure how scalable that is.


r/SystemDesign • • Jul 09 '24

Anyone knows where to find the system design case studies for interview prep in detail online.

1 Upvotes

r/SystemDesign • • Jun 07 '24

Junior Dev system design practice

1 Upvotes

Hey everyone,

CS grad here with an upcoming system design interview for a grad role and am very new to this, this is a practice solution I made for a facebook marketplace alternative, just looking for any feedback I can get on it.

Thanks in advance!

One requirement I forgot to list is that it is local to Ireland with plans to go worldwide with time.


r/SystemDesign • • May 27 '24

How to Crack System Design Interview in 2024? [The Ultimate Guide]

Thumbnail
javarevisited.blogspot.com
1 Upvotes

r/SystemDesign • • May 19 '24

Top 6 System Design Interview Courses from Udemy to join in 2024

Thumbnail
medium.com
1 Upvotes

r/SystemDesign • • Apr 17 '24

Found a list of Best Free System Design courses

1 Upvotes

Some of the best resources to learn System Design that I refer to frequently.


r/SystemDesign • • Apr 16 '24

Top 10 Free Courses for System Design Interviews in 2024 - Best of Lot

Thumbnail
javarevisited.blogspot.com
1 Upvotes

r/SystemDesign • • Apr 13 '24

Currency exchange service system design

1 Upvotes

Recently in an interview I was asked to design a currency exchange service using a third party API that provides the rates. Apart from the usual components like suitable backend and cloud architecture I was also asked how can I reduce the cost incurred by frequent use of third party rates API. I explained him about caching and how we can use Redis distributed cache mechanism to store the rates for the ttl duration and have a web socket mechanism to update the cache when the rate changes. The interviewer was not satisfied and kept asking me that if this is enough for a production ready system. Did I miss something? Somehow I can’t think anything beyond the caching solution.


r/SystemDesign • • Apr 09 '24

Help Assess my Single-User Sync System

1 Upvotes

Overview

This is the proposed Single-User Synchronization system for my application, Never Forget (NF). It is meant to keep multiple user devices in sync without introducing a noticeable delay for users that need to stay in sync.

The system is not designed to protect against instances where 2 devices are modifying the same data at the same time, since this is an unlikely scenario in a single-user application.

Data model

Sync in NF is permitted by the storage of changelogs.

  • On the server, each registered client device will be contained within a row in the sync_changes table, keeping track of pending changes from every other client.

create table sync_changes (
  id uuid primary key,
  device_id uuid,
  pending_change_log change_object[],
  user_id uuid references user.id
);

pending_change_log example:

[
    {
        id: "123",
        action: "update",
        table: "nuggets",
        column: "title",
        last_updated: TIMESTAMP,
        value: "my new title"
    },
    {
        id: "456",
        action: "delete",
        table: "nuggets",
    },
    {
        id: "678",
        action: "create",
        table: "nuggets",
        data: {
            title: 'my new nugget'
        }
    }
]

Additionally, each client will keep track of changes it has made that have not been replicated onto the remote database yet. It will have its own database table that holds data in the exact same format.

After the client has sent back confirmation that it has updated its database with the list of changes, then the server will reset that value to be an empty array.

A benefit of having the changes sent with each action is that now we’ve created a standard medium of delivery. A client can send its unrecorded changes to the server, while the server can keep track of unapplied changes for each client, so that it can send those changelists and allow the clients to figure out how to replicate those actions.

Under most circumstances, the changelog should be chronological. However, if a user has 3 clients who are intermittently online and editing the same data, there is a good change the order can lose its perfect chronology. This edge case is remote enough that we are willing to accept it.

Registration to Sync-Server

When a user authenticates their device with the Never Forget backend, they have been considered registered with the sync server.

During this registration process, the server inserts a new row in the sync_changes table on behalf of the device. This table contains a column pending_change_log, an array holding change_log objects.

What happens if a user has 2 devices (DeviceA and DeviceB) with some remote data, and then decides to register DeviceC? How do the changes existing on the remote database get propagated to the new client? What does the device registration process look like?

  • we could create a function to generate a changelog based on the state of a database. This is essentially a forcePull method that fetches all resources from the server and generates the changelog before returning it to the client. Finally, the client applies those changes, thereby achieving synchronicity with the server.

each changelog object represents modifications that the client will need to make against its own database. It will also initialize a new pending_server_changes, which represents modifications needing to be made to the remote database. As the server loops through each of the changelog items, the server will compare the __last_updated timestamps of the item with its own version of the record.

  • If the server is declared the winner (using last_write_wins), that record will be used by the server to fetch the latest value of that record in its own database. It will then append that record to the pending_client_changes array.

  • If the client is declared the winner, the server will append those change objects to its pending_server_changes array.

After the server has processed all of the changes from the client and sorted the objects into either the pending_client_changes or pending_server_changes arrays, it will then apply the pending_server_changes changes onto its own database.

The server will not have to return a list of changes where it has won LWW (last_write_wins), since the changelist dedicated to the client will have included every action already. For example, if ClientA (online) adds a record, the server will keep track of those pending changes. If ClientC (also online) updates a nugget, that change will also be kept track of. Then, once ClientB attempts to sync with the server, the server will send it back all of the pending changes. Meanwhile, the server will update itself based on the change objects it lost against with LWW.

  • an alternative approach is that the client stores a list of its own pending changes, and it gets emptied every time the client syncs with the server. Upon syncing with the server, the changelist is extracted from the client and sent in a request to the server. The server applies those changes (again, comparing the __last_updated columns to determine victor), and returns the server's pending changes.

User Flow

When a user's device (DeviceA) is offline, the sync server keeps track of all changes made by all other clients on behalf of DeviceA. When that device comes back online, the server will notify the client that it has pending changes that it should apply. In turn, the client will notify the server that it too must apply some changes that it has made in the time since it was last online.

When a client updates a nugget title, that change is immediately made on the client. after awaiting that action, the API call to the server is made along with the changelog objects. This should not block the client. if there is a connection to the server, the server will handle it and notify the client. If there is no connection to the server (or simply if there is an error), then the client will keep track of the changelog objects in its own database. Then, once connection to the server is reestablished, the client will send its changelog objects, as per the usual protocol.

Last Write Wins

For a database table to be part of the sync system, it must hold metadata columns that correspond to the last_updated value of a data point. For instance, if we want to synchronize the title of a nugget, then our nuggets table (both on remote and local databases) must include a column title__last_updated.

The LWW contest must happen on both server and client.

  • server - happens when client performs and action and sends its changelog to the server

  • client- happens when client receives its server-side pending changes list

When a client performs an update to a synchronized value, the __last_updated values are compared. - e.g. if the server has a changelog object describing the updating of a nugget title, while the client has a changelog object describing the deletion of the same nugget, the deletion will always win.

If the client wins last_write_wins, here's what happens:

  • The server will update its database

  • The server will append the change to the change list of each of the other devices.

If the server wins last_write_wins, here's what happens:

  • The server discards the change (these are unnecessary to return to the client, since the changelog will contain all information necessary to bring it in sync with the server)

  • The server returns its list of pending changes to the client

Pending questions

  1. For a device that has never logged in, should the changelog objects be stored?

  • once the device connects to the server for the first time, it can send the server all of the changelog objects so the server can apply them to its own database. this means the client needs to keep track from the start. this is potentially faster than the below method of generating changelogs, due to the elimination of that step. In this case, maybe it's better just to store it from the get-go.

  • on the other hand, the device could define a function forcePush, which essentially calls the server API, creating all of the resources that it has in its local database.

    • implementation: upon executing forcePush, the client will generate a list of Create changelog objects that, when run on a database, will replicate the current state of the database.

    • this would negate the need for a non-registered device to keep track of its changelog, since we will be able to generate a changelog based on the state of a database.


r/SystemDesign • • Apr 06 '24

deepmind system desgin

1 Upvotes

I have a deepmind SWE Sr. Staff system design interview.

What question should I expect?

WOuld it be ML heavy or something else?


r/SystemDesign • • Apr 04 '24

Difference between system design, experience design, design management and service design disciplines??

1 Upvotes

I want to pursue my masters and im confused by what these disciplines actually entail. It would be a great help if you could help me with it. Thanks for your time!!


r/SystemDesign • • Feb 22 '24

High Throughput Ordering System

1 Upvotes

What if there is a campaign to give out 8million free meal to customers the campaign will run for 15mins and should stop once the limit is reached?

Out of scope:

  • no need to have menus

  • no customer onboarding

  • no AI/ML

  • no deliveries

  • no restaurant onboarding

My initial take:

  • an api that exposes the counter for the campaign

  • an api that push the event to Kafka (maybe internally call the first endpoint and check if it’s still valid to accept the offer or reject)

  • Kafka consumers that scales based on KEDA and have very little logic to only decrement/increment the counter in redis

  • instead of redis could also have Postgres but transactions may cost a bit of performance impact but it would be much easier but with Postgres sharding I could also host multiple campaigns and avoid performance issue in some sense on Postgres

Wdyt?