ByteByteGo 01月19日
EP146: The Open Source AI Stack
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

本文概述了系统设计中的关键概念,包括API与SDK的区别、开源AI工具栈、多种身份验证机制(Cookies、Sessions、JWT、PASETO)、系统设计面试中应掌握的算法、负载均衡算法以及TikTok如何管理大型前端代码库。文章强调了开源AI工具的可用性,并对比了各种身份验证方法的优缺点,同时提供了实用的算法知识,还探讨了单体仓库的优势和挑战,以及TikTok如何通过Sparo工具优化Git操作。

🛠️开源AI栈:介绍了构建AI应用的关键组件,包括前端框架(NextJS、Streamlit)、嵌入和RAG库(Nomic、JinaAI)、后端框架(FastAPI、Langchain)、模型访问(Ollama、Huggingface)以及数据存储和检索方案(Postgres、Milvus)。

🔑身份验证机制:对比了Cookies和Sessions(服务器端存储,适用于严格控制),JWT(无状态,可扩展但需谨慎处理),以及PASETO(改进JWT,增强安全性和简化实现)。

💡系统设计算法:强调了系统设计面试中应掌握的算法,虽然没有给出具体算法列表,但强调了理解算法在实际系统中的应用比实现细节更重要。

⚖️负载均衡算法:列举了六种负载均衡算法,包括静态算法(轮询、粘性轮询、加权轮询、哈希)和动态算法(最少连接、最短响应时间)。

🗂️TikTok MonoRepo实践:介绍了TikTok如何通过Sparo工具优化大型前端MonoRepo的Git操作,显著提升了clone、checkout、status和commit等操作的性能。

This week’s system design refresher:


API Vs SDK! What's the difference?


The Open Source AI Stack

You don’t need to spend a fortune to build an AI application. The best AI developer tools are open-source, and an excellent ecosystem is evolving that can make AI accessible to everyone.

The key components of this open-source AI stack are as follows:

    Frontend
    To build beautiful AI UIs, frameworks like NextJS and Streamlit are extremely useful. Also, Vercel can help with deployment.

    Embeddings and RAG libraries
    Embedding models and RAG libraries like Nomic, JinaAI, Cognito, and LLMAware help developers build accurate search and RAG features.

    Backend and Model Access
    For backend development, developers can rely on frameworks like FastAPI, Langchain, and Netflix Metaflow. Options like Ollama and Huggingface are available for model access.

    Data and Retrieval
    For data storage and retrieval, several options like Postgres, Milvus, Weaviate, PGVector, and FAISS are available.

    Large-Language Models
    Based on performance benchmarks, open-source models like Llama, Mistral, Qwen, Phi, and Gemma are great alternatives to proprietary LLMs like GPT and Claude.

    Over to you: Which other tool will you add to the Open Source AI Stack?


Cookies Vs Sessions Vs JWT Vs PASETO

Authentication ensures that only authorized users gain access to an application’s resources. It answers the question of the user’s identity i.e. “Who are you?”

The modern authentication landscape has multiple approaches: Cookies, Sessions, JWTs, and PASETO. Here’s what they mean:

    Cookies and Sessions
    Cookies and sessions are authentication mechanisms where session data is stored on the server and referenced via a client-side cookie.

    Sessions are ideal for applications requiring strict server-side control over user data. On the downside, sessions may face scalability challenges in distributed systems.

    JWT
    JSON Web Token (JWT) is a stateless, self-contained authentication method that stores all user data within the token.

    JWTs are highly scalable but require careful handling to mitigate the chances of token theft and manage token expiration.

    PASETO
    Platform-Agnostic Security Tokens or PASETO improve upon JWT by enforcing stronger cryptographic defaults and eliminating algorithmic vulnerabilities.

    PASETO simplifies token implementation by avoiding the risks associated with misconfiguration.

Over to you: Which authentication approach have you used?


Algorithms you should know before taking System Design Interviews

What are some of the algorithms you should know before taking system design interviews?

I put together a list and explained why they are important. Those algorithms are not only useful for interviews but good to understand for any software engineer.

One thing to keep in mind is that understanding “how those algorithms are used in real-world systems” is generally more important than the implementation details in a system design interview.

What do the stars mean in the diagram?
It’s very difficult to rank algorithms by importance objectively. I’m open to suggestions and making adjustments.

Five-star: Very important. Try to understand how it works and why.

Three-star: Important to some extent. You may not need to know the implementation details.

One-star: Advanced. Good to know for senior candidates.

Over to you: did I miss anything important on the list? Which ones do you know and which you don’t?


Top 6 Load Balancing Algorithms


How TikTok Manages a 200K File Frontend MonoRepo?

A MonoRepo, short for a monolithic repository, is a software development strategy where a single repository contains multiple projects, libraries, and services.

The good parts of a MonoRepo are:

However, the bigger the MonoRepo gets, the slower the various Git operations.

TikTok faced a similar change with its frontend TypeScript MonoRepo with 200K files.

To deal with this, TikTok built a tool named Sparo that optimizes the performance of Git operations for large frontend MonoRepos.

Sparo dramatically improved the performance of Git operations. Some stats are as follows

Over to you: Have you used MonoRepos in your projects?


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

相关标签

API SDK 身份验证 负载均衡 MonoRepo
相关文章