spark-optimization
यह क्या करती है
यह टूल उन कंप्यूटर प्रोग्राम्स को तेज़ और ज़्यादा कुशल बनाने में मदद करता है जो बड़ी मात्रा में डेटा प्रोसेस करते हैं (Apache Spark में इन्हें 'jobs' कहते हैं)। यह बदलाव करता है कि डेटा कैसे व्यवस्थित हो और कैसे प्रोसेस हो।
कब इस्तेमाल करें
- ✓जब कोई डेटा प्रोसेसिंग प्रोग्राम पूरा होने में बहुत समय ले रहा हो।
- ✓जब प्रोग्राम को धीमा किए बिना ज़्यादा डेटा संभालने लायक बनाना हो।
- ✓जब आप देखें कि प्रोग्राम बहुत ज़्यादा मेमोरी ले रहा है या दूसरे कंप्यूटरों से बात करने में धीमा है।
Skill का लिंक
https://github.com/wshobson/agents/blob/main/plugins/data-engineering/skills/spark-optimization/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मैं अपने डेटा प्रोसेसिंग प्रोग्राम को तेज़ी से कैसे चला सकता हूं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह टूल प्रोग्राम के काम करने के तरीके का विश्लेषण करता है और बदलाव सुझाता है। यह बदल सकता है कि डेटा कैसे बांटा जाए, मेमोरी कैसे इस्तेमाल हो, और प्रोग्राम के हिस्सों के बीच जानकारी का आदान-प्रदान कैसे हो।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Apache Spark Optimization
Production patterns for optimizing Apache Spark jobs including partitioning strategies, memory management, shuffle optimization, and performance tuning.
When to Use This Skill
- Optimizing slow Spark jobs
- Tuning memory and executor configuration
- Implementing efficient partitioning strategies
- Debugging Spark performance issues
- Scaling Spark pipelines for large datasets
- Reducing shuffle and data skew
Core Concepts
1. Spark Execution Model
Driver Program
↓
Job (triggered by action)
↓
Stages (separated by shuffles)
↓
Tasks (one per partition)
2. Key Performance Factors
| Factor | Impact | Solution |
|---|---|---|
| Shuffle | Network I/O, disk I/O | Minimize wide transformations |
| Data Skew | Uneven task duration | Salting, broadcast joins |
| Serialization | CPU overhead | Use Kryo, columnar formats |
| Memory | GC pressure, spills | Tune executor memory |
| Partitions | Parallelism | Right-size partitions |
Quick Start
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
# Create optimized Spark session
spark = (SparkSession.builder
.appName("OptimizedJob")
.config("spark.sql.adaptive.enabled", "true")
.config("spark.sql.adaptive.coalescePartitions.enabled", "true")
.config("spark.sql.adaptive.skewJoin.enabled", "true")
.config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
.config("spark.sql.shuffle.partitions", "200")
.getOrCreate())
# Read with optimized settings
df = (spark.read
.format("parquet")
.option("mergeSchema", "false")
.load("s3://bucket/data/"))
# Efficient transformations
result = (df
.filter(F.col("date") >= "2024-01-01")
.select("id", "amount", "category")
.groupBy("category")
.agg(F.sum("amount").alias("total")))
result.write.mode("overwrite").parquet("s3://bucket/output/")
Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
Do's
- Enable AQE - Adaptive query execution handles many issues
- Use Parquet/Delta - Columnar formats with compression
- Broadcast small tables - Avoid shuffle for small joins
- Monitor Spark UI - Check for skew, spills, GC
- Right-size partitions - 128MB - 256MB per partition
Don'ts
- Don't collect large data - Keep data distributed
- Don't use UDFs unnecessarily - Use built-in functions
- Don't over-cache - Memory is limited
- Don't ignore data skew - It dominates job time
- Don't use
.count()for existence - Use.take(1)or.isEmpty()
अक्सर पूछे जाने वाले सवाल
'shuffle' क्या है?
जब प्रोग्राम को डेटा को अलग-अलग कंप्यूटरों के बीच दोबारा व्यवस्थित करना पड़ता है, उसे shuffle कहते हैं। ज़्यादा फेरबदल से प्रोग्राम धीमा हो जाता है।
'data skew' क्या है?
जब कुछ कंप्यूटरों को दूसरों से कहीं ज़्यादा डेटा प्रोसेस करने को मिल जाता है, तो इसे data skew कहते हैं। इससे पूरा job देर से पूरा होता है।
'partitions' क्या होते हैं?
ये डेटा के छोटे टुकड़े होते हैं। सही संख्या में टुकड़े होने से प्रोग्राम एक साथ (parallel) काम कर पाता है और तेज़ चलता है।
जानकारी
लेखक का मूल विवरण
Optimize Apache Spark jobs with partitioning, caching, shuffle optimization, and memory tuning. Use when improving Spark performance, debugging slow jobs, or scaling data processing pipelines.
repo: wshobson/agents
लोकप्रियता
- GitHub स्टार
- 41k
- रैंकिंग में स्थान
- #6672
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
screen-reader-testing
41kआपके एजेंट को screen readers का इस्तेमाल करके वेबसाइटों की जांच करने देता है, ताकि यह पक्का हो सके कि वे accessible हैं।
wcag-audit-patterns
41kआपके एजेंट को वेबसाइटों का accessibility audit करने और WCAG guidelines के हिसाब से समस्याएं ठीक करने में मदद करता है।
multi-reviewer-patterns
41kआपके एजेंट को कई code reviews को एक साथ चलाने देता है। यह एक जैसे findings हटाता है और सारी रिपोर्ट को एक जगह जोड़ता है।
parallel-debugging
41kआपके एजेंट को parallel जांच के साथ जटिल समस्याओं को debug करने और root cause analysis में मदद करता है।
मिलती-जुलती skills
pytorch-patterns
280kआपके एजेंट को machine learning models के लिए PyTorch इस्तेमाल करने में मदद करता है। कुशल model training के best practices लागू करता है और नतीजों को दोहराने लायक रखता है।
evm-token-decimals
280kयह आपके एजेंट को अलग-अलग blockchain networks पर decimal numbers की गलतियों से बचने में मदद करता है। यह transactions और calculations में token values सही रखने का ध्यान रखता है।
ito-inference
280kआपके एजेंट को AI models की उपलब्धता जाँचने देता है। यह compute request को तैयार model service से जोड़ता है।