# Plan

## Формализация задачи

функциональные требования (что пользователь хочет от системы в виде сценариев, jobs to be done)

нефункциональные требования (главные архитектурные характеристики: sizing, rps)

{% hint style="info" %}
определить важность и интересность требований, которую разбирать на собесе
{% endhint %}

## Границы системы

выбрать правильный способ интеграции системы: files, DB, API, messaging.

:white\_check\_mark: if (API) REST?, RPC?, GraphQL, AsyncAPI

:white\_check\_mark: выбрать сети и протоколы (TCP, UDP)

:white\_check\_mark: Балансировщики нагрузки (nginx, HAproxy)

обрабатываемые сценарии

```ini
NFR questions / aspects:
- DAU / MAU
- кол-во пользователей через 5-10 лет
- кол-во операций пользователем в день
- RPS, сетевой трафик, кол-во соединений
- CPU
- HDD / SSD (only 85% of disk space is available, 3-5% disks are destroyed over the year, do not forget about replication)
- $$$

~ 100_000 sec in a day (86400 accurately)
read 1MB sequentially from network ~ 10ms
read 1MB sequentially from disk ~ 30ms
Google SRE book with calcualtions (recommended to have a look)

TODO
- websocket vs long polling
```

## Потоки данных и компоненты системы

happy path. Read / write path

corner cases (когда части системы отваливаются). Уточнить на собесе что именно т до какой глубины здесь прорабатывать

проговорить логи, мониторинг, миграцию данных

TODO:

* stateless / stateful нагрузки (как разделять?)
* how to store documents in document oriented dbs
* :white\_check\_mark: repeat relations in DB ( 1 to many, etc)
* K/V, document oriented, column oriented, graph
  * по конкретным базам проработать
    * понять гарантии. Какой диапазон нагрузок они потянут. Дрифты часов
* :white\_check\_mark: :question:DDD
* :white\_check\_mark: Entity-Relationship diagram
* twelve factor app
* :white\_check\_mark: what is failure domains
* как масштабировать stateless/stateful компоненты на чтение, на запись (с использованием оркестраторов, горизонтальное, вертикальное)
  * :white\_check\_mark: partitioning vs sharding

Важно:

* задавать правильные вопросы
* не комититься на задачи, которые не нужно решать
* помнить о времени
* не начинать проектировать сразу
* делиться своими размышлениями на собесе
* проявлять самостоятельность и проактивность в проектировании
* реагировать на наводящие вопросы и уточнения
* в конце спросить и почему вы именно эту задачу спрашиваете?&#x20;

## :star:Systems to learn

for 10 euro here there are many of below systems designed [LINK](https://www.educative.io/courses/grokking-modern-system-design-interview-for-engineers-managers)

1. instagram
   1. [Feed, followers](https://www.youtube.com/watch?v=S2y9_XYOZsg)
   2. [Better about feed](https://www.youtube.com/watch?v=wYk0xPP_P_8)
2. :white\_check\_mark:tik tok
3. :white\_check\_mark:twitter (Twitter timeline and search) [LINK](https://github.com/donnemartin/system-design-primer?tab=readme-ov-file#system-design-interview-questions-with-solutions)
   1. [Timelines at Scale](https://www.infoq.com/presentations/Twitter-Timeline-Scalability/)
   2. [Operations at Twitter: Scaling Beyond 100 Million Users](https://www.youtube.com/watch?v=z8LU0Cj6BOU)
4. :white\_check\_mark:url shortener
5. :white\_check\_mark:uber [LINK](https://www.youtube.com/watch?v=Q7shD6ggYto)
6. :white\_check\_mark:доставка еды
7. :white\_check\_mark:whatsup
8. :white\_check\_mark:tinder [Example](https://www.youtube.com/watch?v=tndzLznxq40\&t=1691s)
9. netflix
   1. [Scaling Push Messaging for Millions of Devices](https://www.youtube.com/watch?v=6w6E_B55p0E)
10. Pastebin.com [LINK](https://github.com/donnemartin/system-design-primer?tab=readme-ov-file#system-design-interview-questions-with-solutions)
11. web crawler [LINK](https://github.com/donnemartin/system-design-primer?tab=readme-ov-file#system-design-interview-questions-with-solutions)
12. Mint.com [LINK](https://github.com/donnemartin/system-design-primer?tab=readme-ov-file#system-design-interview-questions-with-solutions)
13. facebook
    1. [Scaling Memcache at Facebook](https://www.usenix.org/conference/nsdi13/technical-sessions/presentation/nishtala)
    2. [Scaling Facebook Live Videos to a Billion Users](https://www.youtube.com/watch?v=IO4teCbHvZw)
    3. [Feed, followers](https://www.youtube.com/watch?v=S2y9_XYOZsg)
    4. [Better about feed](https://www.youtube.com/watch?v=wYk0xPP_P_8)
14. data structures for a social network [LINK](https://github.com/donnemartin/system-design-primer?tab=readme-ov-file#system-design-interview-questions-with-solutions)&#x20;
    1. In details [Facebook’s Distributed Data Store for the Social Graph](https://www.usenix.org/conference/atc13/technical-sessions/presentation/bronson)
15. key-value store for a search engine [LINK](https://github.com/donnemartin/system-design-primer?tab=readme-ov-file#system-design-interview-questions-with-solutions)
16. Amazon's sales ranking by category feature [LINK](https://github.com/donnemartin/system-design-primer?tab=readme-ov-file#system-design-interview-questions-with-solutions)
17. [Introducing Non-Abstract Large System Design](https://sre.google/workbook/non-abstract-design/)
18. :white\_check\_mark:[Capacity planning and hardware selection for DataStax Enterprise implementations](https://docs.datastax.com/en/dseplanning/docs/dse-capacity-planning.html)
19. [Пройти беларуса](https://www.youtube.com/channel/UC9vLsnF6QPYuH51njmIooCQ)
20. [YouTube Scalability](https://www.youtube.com/watch?v=ZW5_eEKEC28)
21. :white\_check\_mark:[Using logs to build a solid data infrastructure](https://www.confluent.io/blog/using-logs-to-build-a-solid-data-infrastructure-or-why-dual-writes-are-a-bad-idea/)
22. :white\_check\_mark:Dropbox [LINK](https://www.youtube.com/watch?v=lamooN_E5aY)

[Back of the envelope calculations](https://www.teamblind.com/post/rBrt5bV8) (good example [LINK](https://ishan-aggarwal.medium.com/back-of-the-envelope-estimation-8e0cdba19a68))

[A lot of links are taken from here](https://www.teamblind.com/post/qubF6fS2)

Great youtube channel [Crushing Tech Education](https://www.youtube.com/@crushingtecheducation/videos); [Jordan has no life](https://www.youtube.com/@jordanhasnolife5163/videos)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://amartyushov.gitbook.io/tech/system-design/interview-preparation/plan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
