SlideShare a Scribd company logo
1 of 12
APACHE
KAFKA
‫تبار‬‫یعقوبی‬ ‫استاد‬
‫کاکا‬ ‫محمدحسین‬
‫سال‬1399-1398
‫مقدمه‬
‫ابزار‬ ‫از‬ ‫مختصری‬ ‫شرح‬ ‫و‬ ‫معرفی‬ ‫به‬ ‫ابتدا‬ ‫مقاله‬ ‫این‬ ‫در‬Apache
Kafka‫پردازیم‬‫می‬.‫مصاحبه‬ ‫از‬ ‫هایی‬ ‫قسمت‬ ‫همچنین‬‫جون‬‫راو‬(Jun
rao)‫کنیم‬‫می‬ ‫بیان‬ ‫را‬ ‫میرسون‬ ‫جف‬ ‫با‬.
2
Apache Kafka‫چیست؟‬
‫آپاچی‬‫کافکا‬‫یک‬‫پلتفرم‬
‫شده‬‫توزیع‬‫برای‬‫پردازش‬‫داده‬‫های‬
‫جریانی‬‫بوده‬‫و‬‫قادر‬‫به‬‫رسیدگی‬
‫و‬‫پردازش‬‫چندین‬‫تریلیون‬‫رویداد‬
‫به‬‫صورت‬‫همزمان‬‫است‬.‫کافکا‬‫در‬
‫ابتدا‬‫به‬‫عنوان‬‫یک‬‫ابزار‬‫برای‬
‫ارسال‬‫پیامهایی‬‫با‬‫تعداد‬‫باال‬
‫بکار‬‫برده‬‫می‬‫شد‬.‫کافکا‬‫از‬
‫زمان‬‫ایجاد‬‫و‬‫منبع‬‫باز‬‫شدن‬
‫توسط‬‫لینکدین‬‫در‬‫سال‬۲۰۱۱،‫به‬
‫سرعت‬‫از‬‫ارسال‬‫پیام‬‫به‬‫یک‬
‫پلتفرم‬‫پردازش‬‫توزیعی‬‫کامل‬
‫تبدیل‬‫شده‬‫است‬.3
Apache Kafka‫کند؟‬‫می‬ ‫کار‬ ‫چگونه‬
o‫وظیفه‬‫و‬‫هدف‬‫اصلی‬Apache Kafka،‫ارائه‬‫یک‬
‫بستر‬‫برای‬‫مدیریت‬‫و‬‫کنترل‬‫های‬‫جریان‬
‫اطالعاتی‬‫با‬‫کارآیی‬‫بسیار‬،‫باال‬‫در‬‫ها‬‫سیستم‬
‫و‬‫زیرسیستمهای‬‫مختلف‬‫است‬.‫یعنی‬‫شما‬
‫توانید‬‫می‬‫با‬‫ایجاد‬‫کردن‬‫یک‬Pipeline‫برای‬
‫جریان‬‫اطالعات‬،‫خود‬‫وابستگی‬‫مستقیم‬
‫سیستمها‬‫و‬‫زیرسیستمها‬‫را‬‫از‬‫بین‬‫ببرید؛‬
‫آن‬‫هم‬‫بصورتی‬‫که‬‫بروز‬‫مشکلی‬‫در‬‫هر‬،‫قسمت‬
‫کمترین‬‫میزان‬‫تاثیر‬‫را‬‫در‬‫سایر‬‫قسمتها‬
‫داشته‬‫باشد‬.
4
Apache Kafka‫کند؟‬‫می‬ ‫کار‬ ‫چگونه‬
‫فرض‬‫کنید‬‫شما‬‫تعداد‬‫زیادی‬‫سیستم‬‫و‬‫زیرس‬‫یستم‬
‫مختلف‬‫را‬‫داشته‬‫باشید‬‫که‬‫هر‬‫کدام‬‫از‬‫آنها‬‫نی‬‫ازمند‬
‫ارتباط‬‫با‬‫برخی‬‫از‬‫قسمتهای‬‫دیگر‬‫است‬.‫در‬‫ای‬‫ن‬
‫صورت‬‫شما‬‫دو‬‫راه‬‫دارید‬:‫اول‬‫اینکه‬‫در‬‫هر‬‫قسمت‬
‫‌هایی‬‫س‬‫سروی‬‫را‬‫برای‬‫ارتباط‬‫با‬‫سایر‬‫‌ه‬‫ت‬‫قسم‬‫ا‬
‫پیاده‬‫سازی‬‫کنید‬‫یا‬‫اینکه‬‫هر‬‫قسمت‬‫بصورت‬
‫مستقیم‬‫با‬‫سایر‬‫قسمتها‬‫در‬‫ارتباط‬‫باشد‬.
5
Apache Kafka‫کند؟‬‫می‬ ‫کار‬ ‫چگونه‬
o‫روش‬Apache Kafka‫برای‬‫رفع‬‫این‬
‫مشکل‬‫به‬‫این‬‫صورت‬‫است‬‫که‬Kafka
‫با‬‫بر‬‫عهده‬‫گرفتن‬‫مدیریت‬
‫ارتباطات‬‫و‬‫جریان‬‫ای‬‫داده‬‫های‬‫قسمت‬
،‫مختلف‬‫به‬‫شما‬‫کمک‬‫کند‬‫می‬‫تا‬‫تیم‬
‫پیاده‬،‫سازی‬‫تنها‬‫تمرکزشان‬‫را‬‫بر‬
‫روی‬Business‫ی‬‫که‬‫خواهند‬‫می‬‫پیاده‬
‫سازی‬،‫کنند‬‫قرار‬‫دهند‬.‫با‬‫این‬
‫روش‬‫توانیم‬‫می‬‫به‬‫راحتی‬‫هایی‬‫سیستم‬
‫را‬‫پیاده‬‫سازی‬‫کنیم‬‫که‬‫از‬‫نظر‬
‫ارتباطی‬‫در‬‫حالت‬،‫معمول‬‫پیچیده‬
‫یا‬‫بسیار‬‫اند‬‫پیچیده‬.
6
7
‫ساختار‬‫کافکا‬
‫کند‬ ‫می‬ ‫کار‬ ‫سرور‬ ‫چند‬ ‫یا‬ ‫یک‬ ‫روی‬ ‫بر‬ ‫ای‬ ‫خوشه‬ ‫صورت‬ ‫به‬ ‫کافکا‬.
‫نام‬ ‫به‬ ‫ساختارهایی‬ ‫در‬ ‫را‬ ‫ها‬ ‫رکورد‬ ‫و‬ ‫ها‬ ‫داده‬ ‫جریان‬ ‫کافکا‬
‫تاپیک‬( topics)‫کند‬ ‫می‬ ‫ذخیره‬.
‫باشد‬ ‫می‬ ‫زمانی‬ ‫برچسب‬ ‫یک‬ ‫و‬ ‫مقدار‬ ‫یک‬ ،‫کلید‬ ‫یک‬ ‫دارای‬ ‫رکوردی‬ ‫هر‬
‫باشد‬ ‫مشخص‬ ‫ها‬ ‫رکورد‬ ‫سایر‬ ‫از‬ ‫مجزا‬ ‫بصورت‬ ‫تا‬.
‫تعاری‬
‫ف‬
8
‫پذیری‬ ‫توسعه‬ ‫یا‬ ‫پذیری‬ ‫مقیاس‬
(Scalability)
۱.‫اصطالح‬ ‫به‬ ‫یا‬ ‫عمودی‬ ‫توسعه‬
Scale Up
۲.‫اصطالح‬ ‫به‬ ‫یا‬ ‫افقی‬ ‫توسعه‬
Scale Out
Producer
(‫ارسال‬‫تولید‬ ‫رابط‬ ‫یا‬ ‫پیام‬ ‫کننده‬
‫کننده‬)
Consumer
(‫دریافت‬‫مصرف‬ ‫رابط‬ ‫یا‬ ‫پیام‬ ‫کننده‬
‫کننده‬)
Consumer Group
Broke
Cluster
Topic
PartitionPrimary Broker
Replicas Brokers
Replication Factor
Apache ZooKeeper
9
‫کار‬‫نحوه‬ ‫شماتیک‬
‫کافکا‬
‫ی‬ ّ‫کل‬ ‫معماری‬
10
‫کار‬‫نحوه‬‫کافکا‬
‫کلی‬ ‫بصورت‬
‫کافکا‬‫هایی‬‫پیام‬‫را‬‫که‬‫از‬‫بسیاری‬‫از‬"‫تولید‬‫کنندگان‬"
‫دریافت‬‫می‬‫کند‬‫را‬‫ذخیره‬‫کرده‬‫و‬‫داده‬‫ها‬‫بدین‬‫صورت‬‫بر‬‫روی‬
‫پارتیشن‬‫های‬‫گوناگونی‬‫در‬"‫های‬‫تاپیک‬"‫مختلف‬‫توزیع‬‫شده‬‫و‬
‫پارتیشن‬‫بندی‬‫می‬‫شوند‬.‫در‬‫هر‬‫پارتیشن‬‫ها‬‫پیام‬‫با‬‫هم‬‫شاخص‬
‫گذاری‬‫شده‬‫و‬‫با‬‫یک‬‫برچسب‬‫زمانی‬‫ذخیره‬‫می‬‫شوند‬.‫سایر‬
‫فرایندها‬‫مثل‬"‫مصرف‬‫کنندگان‬"‫می‬‫توانند‬‫ها‬‫پیام‬‫را‬‫از‬
‫ها‬‫پارتیشن‬‫دریافت‬‫کرده‬‫و‬‫اطالعات‬‫مورد‬‫نظر‬‫خود‬‫را‬‫درخواست‬
‫کنند‬.‫کافکا‬‫بر‬‫روی‬‫خوشه‬‫هایی‬‫از‬‫یک‬‫یا‬‫چند‬‫سرور‬‫اجرا‬‫می‬
‫شود‬‫و‬‫ها‬‫پارتیشن‬‫می‬‫توانند‬‫بر‬‫روی‬‫چندین‬‫نود‬‫مختلف‬‫توزیع‬
‫شوند‬.
11
‫های‬ ‫ضمانت‬
‫کافکا‬
12
Kafka‫از‬ ‫اند‬ ‫عبارت‬ ‫که‬ ‫دهد‬‫می‬ ‫خودش‬ ‫کار‬ ‫برای‬ ‫ضمانت‬ ‫سه‬ ،:‫یک‬ ‫در‬ ‫دریافتی‬ ‫های‬‫پیام‬ ‫تمامی‬
Partition‫از‬‫یک‬Topic‫همان‬ ‫به‬ ،
‫ذخیره‬ ‫شوند‬‫می‬ ‫دریافت‬ ‫که‬ ‫ترتیبی‬
‫شوند‬‫می‬.
Consumer‫را‬ ‫ها‬‫پیام‬ ‫تمامی‬ ‫ها‬
‫یک‬ ‫در‬Partition‫به‬‫همان‬
،‫اند‬‫شده‬ ‫ذخیره‬ ‫که‬ ‫ترتیبی‬
‫کنند‬‫می‬ ‫دریافت‬.
‫در‬‫یک‬Topic‫با‬Replication Factor‫ای‬
‫مقدار‬ ‫با‬N،‫تحمل‬ ‫درجه‬‫خطا‬N - 1
‫باشد‬‫می‬.

More Related Content

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Apache kafka