-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.xml
More file actions
215 lines (179 loc) · 18 KB
/
1.xml
File metadata and controls
215 lines (179 loc) · 18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<svg width="1200" height="800" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="kafkaGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#2E86C1;stop-opacity:1" />
<stop offset="100%" style="stop-color:#5DADE2;stop-opacity:1" />
</linearGradient>
<linearGradient id="sparkGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#E67E22;stop-opacity:1" />
<stop offset="100%" style="stop-color:#F39C12;stop-opacity:1" />
</linearGradient>
<linearGradient id="elasticGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#28B463;stop-opacity:1" />
<stop offset="100%" style="stop-color:#58D68D;stop-opacity:1" />
</linearGradient>
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="3" dy="3" stdDeviation="2" flood-color="#000000" flood-opacity="0.3"/>
</filter>
</defs>
<!-- Background -->
<rect width="1200" height="800" fill="#F8F9FA"/>
<!-- Title -->
<text x="600" y="30" font-family="Arial, sans-serif" font-size="24" font-weight="bold" text-anchor="middle" fill="#2C3E50">
Distributed ML Platform - Real-time Sensor Data Processing Architecture
</text>
<!-- Data Ingestion Layer -->
<rect x="50" y="70" width="1100" height="140" rx="10" fill="#ECF0F1" stroke="#BDC3C7" stroke-width="2" filter="url(#shadow)"/>
<text x="70" y="90" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#2C3E50">DATA INGESTION LAYER</text>
<!-- Producer.js -->
<rect x="80" y="110" width="140" height="80" rx="5" fill="#3498DB" stroke="#2980B9" stroke-width="2"/>
<text x="150" y="130" font-family="Arial, sans-serif" font-size="12" font-weight="bold" text-anchor="middle" fill="white">producer.js</text>
<text x="150" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Sensor Data Gen</text>
<text x="150" y="158" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• 1000 msg/sec</text>
<text x="150" y="171" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• JSON Format</text>
<text x="150" y="184" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">Port: 29092</text>
<!-- Zookeeper -->
<rect x="280" y="110" width="120" height="80" rx="5" fill="#8E44AD" stroke="#7D3C98" stroke-width="2"/>
<text x="340" y="130" font-family="Arial, sans-serif" font-size="12" font-weight="bold" text-anchor="middle" fill="white">Zookeeper</text>
<text x="340" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">Port: 2181</text>
<text x="340" y="158" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Coordination</text>
<text x="340" y="171" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Leader Election</text>
<text x="340" y="184" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Metadata Mgmt</text>
<!-- Kafka Cluster -->
<rect x="460" y="110" width="180" height="80" rx="5" fill="url(#kafkaGrad)" stroke="#1B4F72" stroke-width="2"/>
<text x="550" y="130" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="white">Apache Kafka</text>
<text x="550" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">Ports: 9092, 29092</text>
<text x="550" y="158" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• 3 Partitions</text>
<text x="550" y="171" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Replication Factor: 1</text>
<text x="550" y="184" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">Topic: sensor-data</text>
<!-- Kafka Setup -->
<rect x="700" y="110" width="120" height="80" rx="5" fill="#5499C7" stroke="#2E86C1" stroke-width="2"/>
<text x="760" y="130" font-family="Arial, sans-serif" font-size="12" font-weight="bold" text-anchor="middle" fill="white">kafka-setup</text>
<text x="760" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Topic Init</text>
<text x="760" y="158" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Health Check</text>
<text x="760" y="171" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• init-kafka.sh</text>
<!-- Stream Processing Layer -->
<rect x="50" y="240" width="1100" height="200" rx="10" fill="#FDEAA7" stroke="#F4D03F" stroke-width="2" filter="url(#shadow)"/>
<text x="70" y="260" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#2C3E50">STREAM PROCESSING & ML LAYER</text>
<!-- Spark Container -->
<rect x="80" y="280" width="680" height="140" rx="5" fill="url(#sparkGrad)" stroke="#D35400" stroke-width="2"/>
<text x="420" y="300" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="white">Apache Spark Cluster (consumer.py)</text>
<!-- Spark Components -->
<rect x="100" y="320" width="140" height="60" rx="3" fill="#E67E22" stroke="#D35400" stroke-width="1"/>
<text x="170" y="335" font-family="Arial, sans-serif" font-size="10" font-weight="bold" text-anchor="middle" fill="white">Kafka Reader</text>
<text x="170" y="348" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• JSON Parsing</text>
<text x="170" y="358" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Schema Validation</text>
<text x="170" y="368" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Stream Processing</text>
<rect x="260" y="320" width="140" height="60" rx="3" fill="#E67E22" stroke="#D35400" stroke-width="1"/>
<text x="330" y="335" font-family="Arial, sans-serif" font-size="10" font-weight="bold" text-anchor="middle" fill="white">Data Transform</text>
<text x="330" y="348" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Feature Engineering</text>
<text x="330" y="358" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Serial Index Gen</text>
<text x="330" y="368" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Unique Row ID</text>
<rect x="420" y="320" width="140" height="60" rx="3" fill="#E67E22" stroke="#D35400" stroke-width="1"/>
<text x="490" y="335" font-family="Arial, sans-serif" font-size="10" font-weight="bold" text-anchor="middle" fill="white">ML Pipeline</text>
<text x="490" y="348" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Status Predictor</text>
<text x="490" y="358" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Anomaly Detector</text>
<text x="490" y="368" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Humidity Regressor</text>
<rect x="580" y="320" width="140" height="60" rx="3" fill="#E67E22" stroke="#D35400" stroke-width="1"/>
<text x="650" y="335" font-family="Arial, sans-serif" font-size="10" font-weight="bold" text-anchor="middle" fill="white">Output Writer</text>
<text x="650" y="348" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Elasticsearch</text>
<text x="650" y="358" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Console Debug</text>
<text x="650" y="368" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">• Checkpointing</text>
<!-- ML Models -->
<rect x="800" y="280" width="320" height="140" rx="5" fill="#A569BD" stroke="#8E44AD" stroke-width="2"/>
<text x="960" y="300" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="white">Pre-trained ML Models</text>
<rect x="820" y="320" width="90" height="45" rx="3" fill="#BB8FCE" stroke="#8E44AD" stroke-width="1"/>
<text x="865" y="335" font-family="Arial, sans-serif" font-size="9" font-weight="bold" text-anchor="middle" fill="white">Status Flag</text>
<text x="865" y="345" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="white">Accuracy: 95.2%</text>
<text x="865" y="355" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="white">Latency: <10ms</text>
<rect x="920" y="320" width="90" height="45" rx="3" fill="#BB8FCE" stroke="#8E44AD" stroke-width="1"/>
<text x="965" y="335" font-family="Arial, sans-serif" font-size="9" font-weight="bold" text-anchor="middle" fill="white">Anomaly Det</text>
<text x="965" y="345" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="white">Accuracy: 92.1%</text>
<text x="965" y="355" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="white">Latency: <5ms</text>
<rect x="1020" y="320" width="90" height="45" rx="3" fill="#BB8FCE" stroke="#8E44AD" stroke-width="1"/>
<text x="1065" y="335" font-family="Arial, sans-serif" font-size="9" font-weight="bold" text-anchor="middle" fill="white">Humidity Reg</text>
<text x="1065" y="345" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="white">RMSE: 2.3</text>
<text x="1065" y="355" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="white">Latency: <15ms</text>
<rect x="820" y="375" width="290" height="35" rx="3" fill="#D7BDE2" stroke="#8E44AD" stroke-width="1"/>
<text x="965" y="390" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="#2C3E50">Saved Models Directory: ./saved_models/</text>
<text x="965" y="403" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="#2C3E50">• status_flag_model • temp_anomaly_model • humidity_regressor</text>
<!-- Storage & Visualization Layer -->
<rect x="50" y="470" width="1100" height="180" rx="10" fill="#D5F4E6" stroke="#58D68D" stroke-width="2" filter="url(#shadow)"/>
<text x="70" y="490" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#2C3E50">STORAGE & VISUALIZATION LAYER</text>
<!-- Elasticsearch -->
<rect x="80" y="510" width="200" height="120" rx="5" fill="url(#elasticGrad)" stroke="#229954" stroke-width="2"/>
<text x="180" y="530" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="white">Elasticsearch</text>
<text x="180" y="545" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">Port: 9200, 9300</text>
<text x="180" y="558" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Distributed Search</text>
<text x="180" y="571" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Real-time Indexing</text>
<text x="180" y="584" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Index: sensor-index</text>
<text x="180" y="597" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Sharding & Replication</text>
<text x="180" y="610" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Document Store</text>
<!-- Kibana -->
<rect x="320" y="510" width="200" height="120" rx="5" fill="#45B7D1" stroke="#3498DB" stroke-width="2"/>
<text x="420" y="530" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="white">Kibana</text>
<text x="420" y="545" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">Port: 5601</text>
<text x="420" y="558" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Interactive Dashboards</text>
<text x="420" y="571" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Real-time Visualization</text>
<text x="420" y="584" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Geospatial Maps</text>
<text x="420" y="597" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Alert Management</text>
<text x="420" y="610" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Web UI Interface</text>
<!-- Performance Metrics -->
<rect x="560" y="510" width="250" height="120" rx="5" fill="#F8C471" stroke="#F39C12" stroke-width="2"/>
<text x="685" y="530" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="#2C3E50">Performance Metrics</text>
<text x="685" y="548" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="#2C3E50">• Throughput: 700+ msg/sec</text>
<text x="685" y="561" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="#2C3E50">• End-to-End Latency: 250-350ms</text>
<text x="685" y="574" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="#2C3E50">• Horizontal Scaling: Linear</text>
<text x="685" y="587" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="#2C3E50">• ML Inference: Sub-15ms</text>
<text x="685" y="600" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="#2C3E50">• Fault Tolerance: Built-in</text>
<text x="685" y="613" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="#2C3E50">• Checkpointing: /tmp/spark-checkpoints</text>
<!-- Docker Infrastructure -->
<rect x="850" y="510" width="270" height="120" rx="5" fill="#85C1E9" stroke="#5DADE2" stroke-width="2"/>
<text x="985" y="530" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="white">Container Infrastructure</text>
<text x="985" y="548" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Docker Compose Orchestration</text>
<text x="985" y="561" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Service Discovery & Networking</text>
<text x="985" y="574" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Health Checks & Auto-restart</text>
<text x="985" y="587" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Volume Persistence</text>
<text x="985" y="600" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Port Mapping & Exposure</text>
<text x="985" y="613" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">• Environment Configuration</text>
<!-- Data Flow Arrows -->
<!-- Producer to Kafka -->
<path d="M 220 150 L 460 150" stroke="#E74C3C" stroke-width="3" fill="none" marker-end="url(#arrow)"/>
<text x="340" y="145" font-family="Arial, sans-serif" font-size="10" fill="#E74C3C">JSON Messages</text>
<text x="340" y="158" font-family="Arial, sans-serif" font-size="9" fill="#E74C3C">1000 msg/sec</text>
<!-- Zookeeper to Kafka -->
<path d="M 400 150 L 460 150" stroke="#8E44AD" stroke-width="2" fill="none" marker-end="url(#arrow)"/>
<!-- Kafka to Spark -->
<path d="M 550 190 L 550 280" stroke="#2980B9" stroke-width="4" fill="none" marker-end="url(#arrow)"/>
<text x="565" y="230" font-family="Arial, sans-serif" font-size="11" fill="#2980B9">Stream Processing</text>
<text x="565" y="245" font-family="Arial, sans-serif" font-size="10" fill="#2980B9">sensor-data topic</text>
<!-- Spark to Elasticsearch -->
<path d="M 420 420 L 180 470" stroke="#E67E22" stroke-width="3" fill="none" marker-end="url(#arrow)"/>
<text x="280" y="445" font-family="Arial, sans-serif" font-size="10" fill="#E67E22">Processed Data</text>
<text x="280" y="458" font-family="Arial, sans-serif" font-size="9" fill="#E67E22">+ ML Predictions</text>
<!-- Elasticsearch to Kibana -->
<path d="M 280 570 L 320 570" stroke="#28B463" stroke-width="3" fill="none" marker-end="url(#arrow)"/>
<text x="300" y="565" font-family="Arial, sans-serif" font-size="9" fill="#28B463">Query API</text>
<!-- External Access -->
<rect x="50" y="680" width="1100" height="80" rx="10" fill="#FADBD8" stroke="#E8DAEF" stroke-width="2" filter="url(#shadow)"/>
<text x="70" y="700" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#2C3E50">EXTERNAL ACCESS & MONITORING</text>
<rect x="80" y="720" width="180" height="30" rx="3" fill="#3498DB" stroke="#2980B9" stroke-width="1"/>
<text x="170" y="738" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">http://localhost:9200 (Elasticsearch)</text>
<rect x="280" y="720" width="180" height="30" rx="3" fill="#E74C3C" stroke="#C0392B" stroke-width="1"/>
<text x="370" y="738" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">http://localhost:5601 (Kibana)</text>
<rect x="480" y="720" width="180" height="30" rx="3" fill="#F39C12" stroke="#E67E22" stroke-width="1"/>
<text x="570" y="738" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">localhost:29092 (Kafka Producer)</text>
<rect x="680" y="720" width="180" height="30" rx="3" fill="#8E44AD" stroke="#7D3C98" stroke-width="1"/>
<text x="770" y="738" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">docker compose logs -f spark</text>
<rect x="880" y="720" width="180" height="30" rx="3" fill="#16A085" stroke="#138D75" stroke-width="1"/>
<text x="970" y="738" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">curl -X GET localhost:9200/_search</text>
<!-- Arrow markers -->
<defs>
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth">
<path d="M0,0 L0,6 L9,3 z" fill="#E74C3C"/>
</marker>
</defs>
<!-- Legend -->
<rect x="50" y="770" width="200" height="15" rx="5" fill="#34495E"/>
<text x="150" y="781" font-family="Arial, sans-serif" font-size="11" font-weight="bold" text-anchor="middle" fill="white">Technology Stack Integration</text>
</svg>