ByteByteGo 2024年07月27日
EP122: API Gateway 101
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

这篇文章主要探讨了 Session 和 JWT 在系统设计中的区别,并介绍了常用的数据和通信流架构模式,如 API 网关、发布-订阅模式、请求-响应模式等。文章还解释了内容分发网络(CDN)的流行原因,以及全栈开发路线图,涵盖了前端、后端、数据库、移动开发、云计算、UI/UX 设计、基础设施和 DevOps 等方面。

👨‍💻 **Session 和 JWT 的区别**:Session 是一种基于服务器端的机制,使用服务器端存储来维护用户会话状态,而 JWT 是一种基于令牌的机制,将用户身份信息存储在令牌中,并由客户端进行管理。 Session 的优点是安全性高,因为它依赖于服务器端的验证,而 JWT 的优点是易于使用和扩展,因为它不需要服务器端的存储。 选择 Session 还是 JWT 取决于应用场景的需求,例如,对于需要高度安全性的应用,建议使用 Session,而对于需要易于扩展和部署的应用,建议使用 JWT。

🌐 **API 网关**:API 网关是所有客户端请求进入后端服务的单一入口点。它可以提供以下功能: - 请求路由:将传入的 API 请求路由到合适的后端服务。 - 负载均衡:将请求分配到多个服务器,以确保单个服务器不会超负荷。 - 安全性:实施安全措施,如身份验证、授权和数据加密。 - 速率限制和节流:控制客户端在特定时间段内可以发出的请求数量。 - API 合成:将多个后端 API 请求合并成单个前端请求,以优化性能。 - 缓存:临时存储响应,以减少重复处理的需要。

📡 **内容分发网络(CDN)的流行原因**:CDN 的流行原因在于它可以提高性能、增加可用性和降低带宽成本。 - 性能提升:通过将内容缓存到靠近用户的边缘服务器,CDN 可以减少延迟。 - 可用性提高:CDN 可以提供冗余,即使一个边缘服务器出现故障,用户仍然可以访问内容。 - 带宽成本降低:CDN 可以将流量从源服务器转移到边缘服务器,从而降低带宽成本。

🚀 **全栈开发路线图**:全栈开发需要掌握多种技术和工具,涵盖了软件开发的不同领域。 - 前端开发:创建 Web 应用程序的用户界面和用户体验。 - 后端开发:管理服务器端逻辑、数据库和各种服务的集成。 - 数据库开发:管理数据存储、检索和操作。 - 移动开发:为移动设备创建应用程序。 - 云计算:在云平台上部署和管理应用程序。 - UI/UX 设计:设计应用程序的用户界面和用户体验。 - 基础设施和 DevOps:管理基础设施、部署和持续集成/持续交付 (CI/CD) 的应用程序。

📊 **架构模式**:文章还介绍了常用的数据和通信流架构模式,包括: - 点对点:两个组件之间直接通信,无需中央协调器。 - 发布-订阅:通过消息代理将消息的生产者(发布者)与消息的消费者(订阅者)解耦。 - 请求-响应:客户端向服务器发送请求并等待响应。 - 事件溯源:将应用程序的状态更改存储为事件序列。 - ETL:用于从多个来源收集数据,将其转换为结构化格式,并将其加载到目标数据库的数据集成模式。 - 批处理:在一定时间段内或达到某个阈值之前积累数据,然后将其作为单个组进行处理。 - 流式处理:允许实时连续摄取、处理和分析数据流。 - 编排:涉及中央协调器(编排器)管理分布式组件或服务之间的交互,以实现工作流或业务流程。

This week’s system design refresher:


Learn ScyllaDB from Discord Engineer Bo Ingram [FREE BOOK] (Sponsored)

Get practical tips for building low latency, high throughput apps with ScyllaDB

ScyllaDB in Action is a practical guide to everything you need to know about ScyllaDB, from your first queries to running it in a production environment. It’s written by Discord Staff Engineer Bo Ingram, author of the famous blog on how Discord migrated trillions of messages from Cassandra to ScyllaDB. 

This early access preview covers:

Free Book Download


Session Vs JWT: The Differences You May Not Know!


Top 9 Architectural Patterns for Data and Communication Flow


Latest articles

If you’re not a paid subscriber, here’s what you missed.

    "Tidying" Code

    A Crash Course on Relational Database Design

    A Crash Course on Distributed Systems

    A Crash Course in Database Scaling Strategies

    A Crash Course in Database Sharding

To receive all the full articles and support ByteByteGo, consider subscribing:

Subscribe now


API Gateway 101

An API gateway is a server that acts as an API front-end, receiving API requests, enforcing throttling and security policies, passing requests to the back-end service, and then returning the appropriate result to the client.

It is essentially a middleman between the client and the server, managing and optimizing API traffic.

Key Functions of an API Gateway:


Why are Content Delivery Networks (CDN) so Popular?

The CDN market is expected to reach nearly $38 billion by 2028. Companies like Akamai, Cloudflare, and Amazon CloudFront are investing heavily in this area.

There are several factors behind the popularity of CDNs

    The Impact of CDN
    CDNs improve performance, increase availability, and enhance bandwidth costs. With the use of CDN, there is a significant reduction in latency.

    CDN Request Flow
    After DNS resolution, the user’s device sends the content request to the CDN edge server.
    The edge server checks its local cache for the content. If found, the edge server serves the content to the user.
    If not found, the edge server forwards the request to the origin server.
    After receiving the content from the origin server, the edge server stores a copy in its cache and delivers it to the user.

    The Architecture of CDN
    There are multiple components in a CDN’s architecture:

    Origin Server: This is the primary source of content.
    Edge Servers: They cache and server content to the users and are distributed across the world.
    DNS: The DNS resolves the domain name to the IP address of the nearest edge server
    Control Plane: Responsible for configuring and managing the edge servers.

    CDN Request Routing
    GSLB: Routes user requests to the server based on factors like geographic proximity, server load, network conditions
    Anycast DNS: Allows multiple servers to share the same IP address. It helps route incoming traffic to the nearest data center.
    Internet Exchange Points: CDN providers establish a presence at major IXPs, allowing them to exchange traffic directly with ISPs and other networks.

    Best Practices
    Some key best practices to optimize CDN performance are related to security aspects, caching optimizations, and content optimizations.

Over to you: What do you think makes CDNs popular?


A Roadmap for Full-Stack Development

A full-stack developer needs to be proficient in a wide range of technologies and tools across different areas of software development. Here’s a comprehensive look at the technical stacks required for a full-stack developer.

    Frontend Development
    Frontend development involves creating the user interface and user experience of a web application.

    Backend Development
    Backend development involves managing the server-side logic, databases, and integration of various services.

    Database Development
    Database development involves managing data storage, retrieval, and manipulation.

    Mobile Development
    Mobile development involves creating applications for mobile devices.

    Cloud Computing
    Cloud computing involves deploying and managing applications on cloud platforms.

    UI/UX Design
    UI/UX design involves designing the user interface and experience of applications.

    Infrastructure and DevOps
    Infrastructure and DevOps involve managing the infrastructure, deployment, and continuous integration/continuous delivery (CI/CD) of applications.


SPONSOR US

Get your product in front of more than 1,000,000 tech professionals.

Our newsletter puts your products and services directly in front of an audience that matters - hundreds of thousands of engineering leaders and senior engineers - who have influence over significant tech decisions and big purchases.

Space Fills Up Fast - Reserve Today

Ad spots typically sell out about 4 weeks in advance. To ensure your ad reaches this influential audience, reserve your space now by emailing sponsorship@bytebytego.com

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

系统设计 Session JWT API 网关 CDN 全栈开发
相关文章