-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystemDesign.excalidraw
More file actions
1918 lines (1918 loc) · 320 KB
/
systemDesign.excalidraw
File metadata and controls
1918 lines (1918 loc) · 320 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"type": "excalidraw",
"version": 2,
"source": "https://marketplace.visualstudio.com/items?itemName=pomdtr.excalidraw-editor",
"elements": [
{
"id": "dWuMn0UrR8UKGEiKRDSZk",
"type": "line",
"x": 280,
"y": 92,
"width": 0,
"height": 363,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a3",
"roundness": {
"type": 2
},
"seed": 1372045628,
"version": 195,
"versionNonce": 1238024508,
"isDeleted": false,
"boundElements": [],
"updated": 1758383365760,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
0,
363
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": null
},
{
"id": "bkE8LaDbU41AEPHVbJsNM",
"type": "text",
"x": 307.6887528722431,
"y": 95,
"width": 776.4132080078125,
"height": 346.705882352941,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a4",
"roundness": null,
"seed": 1726062852,
"version": 1407,
"versionNonce": 798507268,
"isDeleted": false,
"boundElements": [],
"updated": 1758383491588,
"link": null,
"locked": false,
"text": "写在前面:现代社会几乎每一个人都使用聊天应用程序,为什么还要编写“聊天室项目”?\n \n答案有很多,主要有以下几点的考虑:\n \n 1. 从数据安全角度出发,公共聊天服务器的数据所有权属于平台方。企业/组织是\n 是无法掌握数据存储、流转和销毁的全流程。\n\n 2. 从公司业务的角度出发,公共聊天服务器或者应用软件无法实现深度定制,无法与\n 企业的业务系统深度耦合。\n\n 3. 从性能和稳定性的角度出发,公共的IM服务器是共享的,高并发环境下可能会出现\n 故障,而自建的服务可能会更加稳定,并且可以做定制化的保障。\n\n 4. 主要是为了提升系统设计和技术能力。",
"fontSize": 19.811764705882343,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "写在前面:现代社会几乎每一个人都使用聊天应用程序,为什么还要编写“聊天室项目”?\n \n答案有很多,主要有以下几点的考虑:\n \n 1. 从数据安全角度出发,公共聊天服务器的数据所有权属于平台方。企业/组织是\n 是无法掌握数据存储、流转和销毁的全流程。\n\n 2. 从公司业务的角度出发,公共聊天服务器或者应用软件无法实现深度定制,无法与\n 企业的业务系统深度耦合。\n\n 3. 从性能和稳定性的角度出发,公共的IM服务器是共享的,高并发环境下可能会出现\n 故障,而自建的服务可能会更加稳定,并且可以做定制化的保障。\n\n 4. 主要是为了提升系统设计和技术能力。",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "lDBR5_75unJ5jkLLv160S",
"type": "line",
"x": 281,
"y": 493,
"width": 0,
"height": 379,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a5",
"roundness": {
"type": 2
},
"seed": 1086238596,
"version": 108,
"versionNonce": 1801512764,
"isDeleted": false,
"boundElements": [],
"updated": 1758384092987,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
0,
379
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": null
},
{
"id": "yFa2QbTT593yMaLYOAioX",
"type": "text",
"x": 329,
"y": 506,
"width": 803.97998046875,
"height": 375,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aA",
"roundness": null,
"seed": 1998991236,
"version": 1103,
"versionNonce": 845829050,
"isDeleted": false,
"boundElements": [],
"updated": 1760324490075,
"link": null,
"locked": false,
"text": "需求分析 :\n \n 与其说需要构建的是“聊天室项目”,不如说是构建“聊天室组件”,我们考虑构建一个\n 模块化、可定制的聊天室组件系统,用户可以像 “搭积木” 一样选择所需功能组件,\n 编译后直接运行。我们从最简单的需求出发:\n\n 1. 功能性需求:\n - 单聊,1 v 1的聊天。\n - 群聊,多人的聊天室,人数不宜过多。\n\n 2. 非功能性需求:\n - 用户量,1B,(很冗余的设计,从业务出发的聊天应用基本不会达到这个并发量)\n - 延迟,0.5s,\n \n 接下来,我们从一个单体式应用出发。",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "需求分析 :\n \n 与其说需要构建的是“聊天室项目”,不如说是构建“聊天室组件”,我们考虑构建一个\n 模块化、可定制的聊天室组件系统,用户可以像 “搭积木” 一样选择所需功能组件,\n 编译后直接运行。我们从最简单的需求出发:\n\n 1. 功能性需求:\n - 单聊,1 v 1的聊天。\n - 群聊,多人的聊天室,人数不宜过多。\n\n 2. 非功能性需求:\n - 用户量,1B,(很冗余的设计,从业务出发的聊天应用基本不会达到这个并发量)\n - 延迟,0.5s,\n \n 接下来,我们从一个单体式应用出发。",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "s6E__UzGoP4mR8Es3_ltv",
"type": "image",
"x": 326,
"y": 1125,
"width": 750,
"height": 500,
"angle": 0,
"strokeColor": "transparent",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aB",
"roundness": null,
"seed": 1703233596,
"version": 360,
"versionNonce": 653432561,
"isDeleted": false,
"boundElements": [],
"updated": 1758417317737,
"link": null,
"locked": false,
"status": "pending",
"fileId": "5f36c4f18c54e94d932ee20f0325410653ee9ad7",
"scale": [
1,
1
],
"crop": null
},
{
"id": "myA-eJ8RHx7k9fY5AbIgv",
"type": "line",
"x": 284.1648754558883,
"y": 970.7660576233874,
"width": 0,
"height": 648.2339423766126,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aC",
"roundness": {
"type": 2
},
"seed": 1696686084,
"version": 456,
"versionNonce": 1750813855,
"isDeleted": false,
"boundElements": [],
"updated": 1758417317737,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
0,
648.2339423766126
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": null
},
{
"id": "ZUFw2h6T7yig-E5wckqI6",
"type": "freedraw",
"x": 166,
"y": 690,
"width": 155,
"height": 65,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aD",
"roundness": null,
"seed": 721483652,
"version": 27,
"versionNonce": 30277948,
"isDeleted": false,
"boundElements": [],
"updated": 1758384171949,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
3,
0
],
[
11,
0
],
[
23,
0
],
[
34,
1
],
[
43,
4
],
[
51,
6
],
[
58,
9
],
[
63,
13
],
[
68,
18
],
[
75,
27
],
[
83,
36
],
[
94,
46
],
[
106,
56
],
[
113,
61
],
[
118,
64
],
[
122,
65
],
[
125,
65
],
[
130,
65
],
[
136,
65
],
[
143,
65
],
[
149,
65
],
[
153,
65
],
[
154,
65
],
[
155,
65
],
[
155,
65
]
],
"pressures": [],
"simulatePressure": true,
"lastCommittedPoint": null
},
{
"id": "utV3hL_x6N9XtQ2aQGzFT",
"type": "freedraw",
"x": 194,
"y": 674,
"width": 36,
"height": 40,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aE",
"roundness": null,
"seed": 978849796,
"version": 19,
"versionNonce": 2004926140,
"isDeleted": false,
"boundElements": [],
"updated": 1758384173090,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
0,
-1
],
[
-5,
-1
],
[
-12,
0
],
[
-20,
1
],
[
-29,
3
],
[
-35,
4
],
[
-36,
5
],
[
-36,
6
],
[
-36,
10
],
[
-33,
16
],
[
-28,
22
],
[
-21,
29
],
[
-14,
33
],
[
-9,
37
],
[
-6,
39
],
[
-5,
39
],
[
-5,
39
]
],
"pressures": [],
"simulatePressure": true,
"lastCommittedPoint": null
},
{
"id": "7nYVMvlqhOVCRX9-wu4CG",
"type": "text",
"x": 6,
"y": 615,
"width": 160,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aF",
"roundness": null,
"seed": 848079364,
"version": 162,
"versionNonce": 805888388,
"isDeleted": false,
"boundElements": [],
"updated": 1758384250401,
"link": null,
"locked": false,
"text": "随着架构的升级\n需求解构也会变化",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "随着架构的升级\n需求解构也会变化",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "-FnkgH_0UZqnokOvRrLg5",
"type": "text",
"x": 332,
"y": 979,
"width": 744.1798706054688,
"height": 125,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aG",
"roundness": null,
"seed": 1447356860,
"version": 719,
"versionNonce": 1464111313,
"isDeleted": false,
"boundElements": [],
"updated": 1758417317737,
"link": null,
"locked": false,
"text": "参考[kamachat](https://github.com/youngyangyang04/KamaChat)我们设计了\n如下的单体式应用架构:\n\n 1. 后端通过Gin框架设计Restful API,用于处理注册登录,联系人管理等需求。\n 2. 用户登录后与后端的协程建立WebSocket连接,实现实时通信。",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "参考[kamachat](https://github.com/youngyangyang04/KamaChat)我们设计了\n如下的单体式应用架构:\n\n 1. 后端通过Gin框架设计Restful API,用于处理注册登录,联系人管理等需求。\n 2. 用户登录后与后端的协程建立WebSocket连接,实现实时通信。",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "kwRvuEDanO-XniJVd7_Q-",
"type": "text",
"x": 5,
"y": 244,
"width": 236.47998046875,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aH",
"roundness": null,
"seed": 1639678852,
"version": 71,
"versionNonce": 701453116,
"isDeleted": false,
"boundElements": [],
"updated": 1758384584563,
"link": null,
"locked": false,
"text": "为什么要写“聊天室项目“?",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "为什么要写“聊天室项目“?",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "JNU3jjFnGtn_bHlLG8c6c",
"type": "text",
"x": -1,
"y": 1257,
"width": 270.9599304199219,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aI",
"roundness": null,
"seed": 2115947708,
"version": 241,
"versionNonce": 430334143,
"isDeleted": false,
"boundElements": [],
"updated": 1758417317737,
"link": null,
"locked": false,
"text": "单体式应用架构(kamachat)",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "单体式应用架构(kamachat)",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "Jj1jVBRqyT9ITByy87Q_s",
"type": "line",
"x": 284.3027178809046,
"y": 1692.6346122504797,
"width": 0,
"height": 459.2632132625313,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aJ",
"roundness": {
"type": 2
},
"seed": 1136437407,
"version": 624,
"versionNonce": 1788344383,
"isDeleted": false,
"boundElements": [],
"updated": 1758417317274,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
0,
459.2632132625313
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": null
},
{
"id": "y9WUtJ0yONiYC0bBIJ7P6",
"type": "text",
"x": -24.299498785109677,
"y": 2010.5714285714284,
"width": 270.9599304199219,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aK",
"roundness": null,
"seed": 817576575,
"version": 314,
"versionNonce": 624029489,
"isDeleted": false,
"boundElements": [],
"updated": 1758417317274,
"link": null,
"locked": false,
"text": "单体式应用架构(kamachat)",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "单体式应用架构(kamachat)",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "s_4R7sZ7iNSHiZHUW1IsY",
"type": "text",
"x": 331.18046642485126,
"y": 1717.357142857143,
"width": 756.2799682617188,
"height": 425,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aL",
"roundness": null,
"seed": 1307401663,
"version": 1804,
"versionNonce": 1921816671,
"isDeleted": false,
"boundElements": [],
"updated": 1758417317274,
"link": null,
"locked": false,
"text": "单体式应用架构的缺陷:\n \n 1. 难以横向扩展:单体架构没有处理服务端之间的通信,横向扩展不方便。\n 2. “单点故障”:某个小模块出现故障,可能会影响整个服务,造成整个服务重启,\n 破坏可用性。同时问题难以排查。\n\n思考:\n \n 作为聊天服务器来说,我们确实希望一台服务器/距离较近的服务器集群,能够\n完全部署我们的聊天服务。但为了支持多个地区的用户,我们应该设置多个不同地域\n的服务器来支持聊天业务,它们的关系是对等的,能够进行水平的扩展。接下来我们\n需要解决四个问题:\n\n 1. 如何进行服务发现?\n 2. 服务器之间应该交换什么信息?如何交换?\n 3. 单体应用应该拆分成哪些微服务?微服务之间如何通信?\n 4. 数据流如何产生/交换/存储/流转/销毁?",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "单体式应用架构的缺陷:\n \n 1. 难以横向扩展:单体架构没有处理服务端之间的通信,横向扩展不方便。\n 2. “单点故障”:某个小模块出现故障,可能会影响整个服务,造成整个服务重启,\n 破坏可用性。同时问题难以排查。\n\n思考:\n \n 作为聊天服务器来说,我们确实希望一台服务器/距离较近的服务器集群,能够\n完全部署我们的聊天服务。但为了支持多个地区的用户,我们应该设置多个不同地域\n的服务器来支持聊天业务,它们的关系是对等的,能够进行水平的扩展。接下来我们\n需要解决四个问题:\n\n 1. 如何进行服务发现?\n 2. 服务器之间应该交换什么信息?如何交换?\n 3. 单体应用应该拆分成哪些微服务?微服务之间如何通信?\n 4. 数据流如何产生/交换/存储/流转/销毁?",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "pHyl_Ee3C3mOQ0WremY3y",
"type": "rectangle",
"x": -32.7340851713077,
"y": 43.16922034210802,
"width": 1216,
"height": 852,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aN",
"roundness": {
"type": 3
},
"seed": 1217932561,
"version": 60,
"versionNonce": 102588145,
"isDeleted": false,
"boundElements": [],
"updated": 1758417121558,
"link": null,
"locked": false
},
{
"id": "Ct7RZIcgBtK9emoja-HWh",
"type": "rectangle",
"x": -42.7340851713077,
"y": 955.169220342108,
"width": 1216,
"height": 1222.5000000000002,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aO",
"roundness": {
"type": 3
},
"seed": 366368977,
"version": 356,
"versionNonce": 1786993695,
"isDeleted": false,
"boundElements": [],
"updated": 1758417332269,
"link": null,
"locked": false
},
{
"id": "En0mpP-2mKpxlMXu3Irad",
"type": "line",
"x": 295.04254848551017,
"y": 2333.6453111354253,
"width": 2.727272727272748,
"height": 516.5359405352583,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aR",
"roundness": {
"type": 2
},
"seed": 1694332557,
"version": 690,
"versionNonce": 948957165,
"isDeleted": false,
"boundElements": [],
"updated": 1758726953614,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
2.727272727272748,
516.5359405352583
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": null
},
{
"id": "ZHRv41bF6d7yvIopJ9hog",
"type": "text",
"x": 354.45066844505277,
"y": 2358.2698412698414,
"width": 879.179931640625,
"height": 525,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aT",
"roundness": null,
"seed": 306544259,
"version": 2818,
"versionNonce": 967415526,
"isDeleted": false,
"boundElements": [],
"updated": 1760324556543,
"link": null,
"locked": false,
"text": "Kafka是比较常用的消息中间件。常被用来进行实现解耦、异步和削峰。在我们的系统\n设计中也体现了这一点。\n\n我们的消息服务采用了“边缘聚合”的思想,如果两个用户通过同一个服务器进行通信,\n这个公用的服务器会将用户的消息直接转发。如果用户使用不同的服务器,发送端的\n服务器则会把消息发送到Kafka对应消息类型的Topic中。\n\n1. 解耦:Kafka对位于不同服务器的聊天服务做了解耦,本来是通过网络调用的方法紧密耦合的\n 多个聊天服务,如果一个挂了,其它的都会受到影响。但现在,如果一个服务挂了,对应\n 的消息会积压到Kafka里面,不会对其它的服务器造成影响。\n\n2. 异步:如果没有Kafka,我们要经过以下的过程才能给发送端用户返回“消息已成功发送”的提示:\n 发送端客户端--->发送服务端--->调用接收端服务api--->接受端处理消息。\n 同步处理的时间很长,而有了kafka队列,我们在用户消息发送到队列中后,就可以确认消息\n 已经发送。\n\n3. 削峰:如果出现了某个热点聊天室或者消息激增的时段,可以使用kafka来进行流量削峰,应对\n 突发的大流量。当然,我们也设计了基于令牌桶的限流算法,通过IP和ID来限制用户每秒\n 发送的数据,限制用户的恶意行为。\n\n ",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Kafka是比较常用的消息中间件。常被用来进行实现解耦、异步和削峰。在我们的系统\n设计中也体现了这一点。\n\n我们的消息服务采用了“边缘聚合”的思想,如果两个用户通过同一个服务器进行通信,\n这个公用的服务器会将用户的消息直接转发。如果用户使用不同的服务器,发送端的\n服务器则会把消息发送到Kafka对应消息类型的Topic中。\n\n1. 解耦:Kafka对位于不同服务器的聊天服务做了解耦,本来是通过网络调用的方法紧密耦合的\n 多个聊天服务,如果一个挂了,其它的都会受到影响。但现在,如果一个服务挂了,对应\n 的消息会积压到Kafka里面,不会对其它的服务器造成影响。\n\n2. 异步:如果没有Kafka,我们要经过以下的过程才能给发送端用户返回“消息已成功发送”的提示:\n 发送端客户端--->发送服务端--->调用接收端服务api--->接受端处理消息。\n 同步处理的时间很长,而有了kafka队列,我们在用户消息发送到队列中后,就可以确认消息\n 已经发送。\n\n3. 削峰:如果出现了某个热点聊天室或者消息激增的时段,可以使用kafka来进行流量削峰,应对\n 突发的大流量。当然,我们也设计了基于令牌桶的限流算法,通过IP和ID来限制用户每秒\n 发送的数据,限制用户的恶意行为。\n\n ",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "Fe8a6ZUf1z08n7GzBXDja",
"type": "rectangle",
"x": -50.96744122305677,
"y": 2311.130230880231,
"width": 1306.3636363636363,
"height": 572.7272727272725,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aV",
"roundness": {
"type": 3
},
"seed": 843409997,
"version": 70,
"versionNonce": 972714765,
"isDeleted": false,
"boundElements": [
{
"id": "GfBFtcfWWo2jObJ8CO2cd",
"type": "arrow"
}
],
"updated": 1758727370612,
"link": null,
"locked": false
},
{
"id": "RkDOYLrga8dz28EbxpK4U",
"type": "rectangle",
"x": 0.850740595125103,
"y": 2587.493867243867,
"width": 218.18181818181813,
"height": 37.27272727272748,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "cross-hatch",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aW",
"roundness": {
"type": 3
},
"seed": 2074077133,
"version": 61,
"versionNonce": 25696749,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "JQdToGfYupBk0DTCUHoDh"
}
],
"updated": 1758727012103,
"link": null,
"locked": false
},
{
"id": "JQdToGfYupBk0DTCUHoDh",
"type": "text",
"x": 29.941649686034168,
"y": 2593.6302308802306,
"width": 160,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aX",
"roundness": null,
"seed": 1957865923,
"version": 30,
"versionNonce": 1695465773,
"isDeleted": false,
"boundElements": [],
"updated": 1758727006147,
"link": null,
"locked": false,
"text": "消息队列的作用?",
"fontSize": 20,
"fontFamily": 5,