回复: 6
跳转到指定楼层
上一主题 下一主题
收起左侧

2024年灭他设计和题解

   
全局:

2024(10-12月) 码农类General 硕士 全职@Meta - 网上海投 - Onsite  | 😃 Positive 😐 Average | Pass | 在职跳槽

人生第N次面灭他。今年准备把灭他,亚麻,狗狗系统设计题都总结一下。米还差35,先把看得到的设计题过一下。以前的和其他公司链接如下。
(2023年)灭他系统设计半年总结

2024年亚麻设计和题解

2024年Google 设计和题解



原帖 SD:题目具体就不说了是个面经没见过的题目,套的Ads aggregator + top K

老办法,找2个比较详细的帖子解读


Combining and abstracting from the sources provided by HelloInterview and Medium, we can create a unified, abstract system design for an Ad Click Aggregator. This system aims to collect, process, and analyze advertisement click data in real-time and in batch modes, providing actionable insights to optimize advertising campaigns. Here’s a distilled abstract of the system design covering core functionalities, components, and architectural considerations:
第1个帖子比较好的地方,就是给了一些好设计和差设计的比较。帖子本身也有一些设计的缺陷,我会根据经验解读。第2个帖子比较简练,好入手,另外给出一些数据结构的设计。


System Objectives:
The Ad Click Aggregator system is designed to:
        1.        Aggregate click data from various sources in real-time.
        2.        Process and analyze data both in real-time and in batch for deep insights.
        3.        Provide analytics to optimize ad performance and user engagement.
Core Components:
        1.        Data Ingestion Layer
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
processing for immediate feedback and batch processing for historical insights to optimize ad strategies effectively.
Conclusion:
This unified system design abstract presents a comprehensive solution for an Ad Click Aggregator that addresses both real-time and batch processing needs. It is equipped to handle high data volumes, provide fast data access and processing, and deliver deep analytical insights through a robust, scalable architecture. This design ensures that advertisers can leverage timely data to make informed decisions, thereby optimizing their advertising strategies and enhancing user engagement.
还有一点,我想提到的是Privacy和Security。一方面,如果系统被黑了,黑客只能看到一些分析数据。用户姓名/生日/学校等敏感信息,应存在一些访问限制更高的服务器,比如限制IP,限制访问数量。Privacy类似的,商家不能看到具体的用户信息。除非用户已经下单,他们可以从自己的销售网站上去看。前几年的FB剑桥案可以参考一下 差点把FB灭掉,也阻止的小马哥的总统路。

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x

评分

参与人数 21大米 +32 收起 理由
求内推求实习 + 1 很有用的信息!
77777777 + 1 给你点个赞!
桑梓 + 1 很有用的信息!
YY1177 + 1 给你点个赞!
johnnya + 1 很有用的信息!

查看全部评分


上一篇:[面试经验] DD 挂经 请给我米
下一篇:rula店面2轮
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

🔗
 楼主| yangzhit 2024-11-29 11:47:50 来自APP | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
回复

使用道具 举报

🔗
 楼主| yangzhit 2024-12-6 12:22:47 来自APP | 只看该作者
全局:
原帖 sd:camerlcamerlcamerl, 请注意api设计

https://www.1point3acres.com/bbs/thread-1100761-1-1.html
https://leetcode.com/discuss/interview-question/system-design/1835136/design-price-tracker-like-camelcamelcamelcom-looking-for-answers
参考:
https://sumit-ghosh.com/posts/serverless-price-tracker-alert-aws/
https://medium.com/contentarea/a-guide-to-building-your-own-price-tracking-engine-65b2db4b47c7
ChatGPT解读
Goals of the System
        1.        Track product prices across multiple platforms or stores.
        2.        Notify users about price changes or specific price thresholds.
        3.        Provide a user interface for browsing price histories and setting alerts.
        4.        Ensure scalability for handling a large number of products and users.
需求是创建一个监控类似亚马逊网站的产品价格波动的系统。非功能性需求,考虑大量的产品和用户。

Amazon API Gateway提供RESTFul 和 Websocket两种API。Websocket通常用于双向工业应用,比如控制路由器,升级路由器的时候需要双向通讯发送命令。这个例子应该是用REST。API Gateway还可以提供Rate Limit and Load Balance. 
https://aws.amazon.com/api-gateway/ 
Amazon DynamoDB是Cassandra的早期版本。Cassandra 用Column Family->SuperColumn->Column->Value,  多层K-V结构;DynamoDB 基于 KV+Document数据结构。Cassandra自带Region, DynamoDB用Amazon Region。 https://www.influxdata.com/comparison/cassandra-vs-dynamodb/
本例我倾向下文的MongoDB,这样Sharding好最点。本身数据比较小。
SQS用于存Request Message。一个Lambda抓产品信息,一个抓价格信息,两者通过SQS传递。然后价格信息,CRON定期SNS通知用户。


High-Level Architecture
        1.        Frontend:
        •        User-facing application for viewing price histories, setting alerts, and managing subscriptions.
        •        Built with modern frontend frameworks like React or Angular for a responsive UI.
        2.        Backend API:
        •        Handles user requests, manages alerts, and interfaces with the price-tracking engine.
        •        Implemented as a RESTful or GraphQL API.
        3.        Price Scraper:
        •        Scrapes product prices from e-commerce websites using tools like Puppeteer, Selenium, or APIs provided by platforms.
        •        Runs periodically (using cron jobs or serverless triggers) to update the price database.
        4.        Database:
        •        Stores product information, price history, user data, and alerts.
        •        Relational databases like PostgreSQL for structured data or MongoDB for flexibility.
        •        Time-series databases (e.g., InfluxDB) for efficient storage and querying of price history.
        5.        Notification Service:
        •        Sends alerts to users via email, SMS, or push notifications when price changes occur.
        •        Integrate with services like Amazon SES, Twilio, or Firebase Cloud Messaging.
        6.        Scheduler:
        •        Automates periodic scraping and alert-checking tasks.
        •        Can be implemented using tools like AWS Lambda + EventBridge or Celery with workers.


我记得今年比较过几个Time- Series DB,InfluxDB Performance好一点,Prometheus开发容易一点。考虑Scalability得话,倾向InfluxDB。 https://www.influxdata.com/comparison/influxdb-vs-prometheus/
Detailed Design
1. Frontend
        •        Users log in, search for products, and view price histories.
        •        Users can set alerts for desired price points or percentage drops.
        •        Real-time updates using WebSockets or Server-Sent Events (SSE).
2. Backend API
        •        Exposes endpoints for:
        •        User management (POST /users, GET /users/{id}).
        •        Product and price history queries (GET /products/{id}/history).
        •        Setting alerts (POST /alerts).
        •        Implements rate limiting and caching for high-traffic endpoints.
        •        Authentication and authorization using OAuth 2.0 or JWT.
3. Price Scraper
        •        Crawls target websites using:
        •        Headless browsers (e.g., Puppeteer, Playwright) for dynamic pages.
        •        API integrations where available for efficiency.
        •        Avoids getting blocked by using:
        •        Proxies or IP rotation.
        •        User-agent randomization.
        •        Stores scraped data in a temporary queue (e.g., AWS SQS or RabbitMQ) for processing.
4. Data Storage
        •        Relational Database (PostgreSQL):
        •        Tables for users, products, price history, and alerts.
        •        Efficient indexing for fast query performance.
        •        Time-Series Database (InfluxDB):
        •        For storing and analyzing price trends over time.
5. Notification Service
        •        Evaluates price changes against user-defined thresholds.
        •        Sends notifications through:
        •        Email (Amazon SES, SendGrid).
        •        SMS (Twilio).
        •        Push notifications (Firebase Cloud Messaging).
6. Scalability
        •        Use serverless architectures (e.g., AWS Lambda, Azure Functions) to handle fluctuating workloads.
        •        Auto-scaling with containers (e.g., Kubernetes or AWS ECS) for high scraper demand.
上面的Backend API可以结合帖子自己细化一下。Meta我面的是Troubleshooting。Amazon正在准备电话面试,就不深入。


https://systemdesignfightclub.com/price-drop-tracker/ 这个设计要更细一些,思路差不多。



Workflow Example
        1.        Price Scraping:
        •        A scheduled job triggers the scraper to fetch product prices.
        •        Scraped data is validated and stored in the database.
        •        Price history is updated, and alerts are evaluated.
        2.        User Interaction:
        •        User logs in and searches for a product.
        •        Backend retrieves price history and sends it to the frontend.
        •        User sets a price alert for a specific product.
        3.        Notification:
        •        When a price drop is detected, the system sends a notification to the user.


Technologies
        •        Frontend: React, Angular, or Vue.js.
        •        Backend: Node.js (Express), Python (Flask/Django), or Java (Spring Boot).
        •        Scraping: Puppeteer, Playwright, BeautifulSoup.
        •        Database: PostgreSQL, MongoDB, InfluxDB.
        •        Message Queue: RabbitMQ, AWS SQS.
        •        Notifications: Amazon SES, Twilio, Firebase.
        •        Hosting: AWS (Lambda, EC2, S3), Google Cloud, Azure.


前两年给亚马逊做白老鼠,搭建一个卖奢侈品的网站,搭建很方便。就是环境很烂,用的应该是LAMDA这种技术。运行一段时间,服务器就挂了,重启之后,Domain/IP要重新设置。如果面Meta可以把他贬🉐一无是处(Sucks)。当然面Amazon就不行了,可以说很方便,就是有时候不稳定。 https://aws.amazon.com/lightsail/projects/wordpress/
语言的选用,Golang从工业的测试性能最优。相比NodeJS,差不多翻倍。我的理解,Golang充分运用了服务器的多CPU,做Parallel Computing。 其他语言不具备这个能力。


Key Features
        1.        Scalable Scraping:
        •        Use distributed systems to scrape multiple websites concurrently.
        2.        Efficient Storage:
        •        Optimize database queries for large-scale data.
        3.        User Personalization:
        •        Allow users to create custom price alerts.
        4.        Real-Time Updates:
        •        Notify users immediately when price changes occur.
This system design ensures a robust, scalable, and user-friendly price-tracking engine. The architecture leverages serverless and modern cloud technologies to handle large-scale operations effectively.


Scraping抓价格,我想提的是,要注意时间间隔,不让很容易被网站的Rate LIMITER禁IP。

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
回复

使用道具 举报

🔗
 楼主| yangzhit 2024-12-22 14:18:48 来自APP | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
回复

使用道具 举报

🔗
 楼主| yangzhit 2024-12-30 13:59:28 来自APP | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
回复

使用道具 举报

🔗
 楼主| yangzhit 2025-1-1 18:06:27 来自APP | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies

本帖子中包含更多资源

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表