@@ -26,4 +26,41 @@ response.
26
26
27
27
### 6. threadpool
28
28
29
- Main thread for listening new connection, and a threadpool will be used to execute the response callbacks.
29
+ Main thread for listening new connection, and a threadpool will be used to execute the response callbacks.
30
+
31
+ ## Performances
32
+
33
+ Setup: all the results are obtained on macOS 12.4 M1 8 core chip laptop. selector_process server will have 4 worker
34
+ processes, and threadpool server will have a default ` ThreadPoolExecutor ` without worker number arg.
35
+
36
+ ### 1k
37
+
38
+ 1000 client connect and then each one send 100 times.
39
+
40
+ | | select | selectors | selectors_process | thread | threadpool |
41
+ | ---------| --------| -----------| -------------------| ---------| ------------|
42
+ | connect | 0.2328 | 0.0427 | 0.0487 | 0.2784 | 0.0424 |
43
+ | echo | 1.2135 | 1.2332 | 1.3918 | 24.4581 | 1.5212 |
44
+
45
+ ### 10k
46
+
47
+ 10,000 client connect and then each one send 100 times
48
+
49
+ | | select | selectors | selectors_process | thread | threadpool |
50
+ | ---------| --------| -----------| -------------------| --------| ------------|
51
+ | connect | β | 0.4142 | 0.4698 | β | 0.4155 |
52
+ | echo | β | 16.2907 | 19.7788 | β | 16.1532 |
53
+
54
+ * select server failed because of the limit of maximum 1024 fd number of ` select ` .
55
+ * thread server failed because of too many thread created.
56
+
57
+ ### 10k + cpu
58
+
59
+ 10,000 client connect and then each one send 1 times, but server side is slow down by the cpu bound
60
+ task ` sum(range(100000)) ` .
61
+
62
+ | | select | selectors | selectors_process | thread | threadpool |
63
+ | ---------| --------| -----------| -------------------| --------| ------------|
64
+ | connect | β | 0.7029 | 0.5843 | β | 0.5510 |
65
+ | echo | β | 9.2716 | 2.9143 | β | 9.9059 |
66
+
0 commit comments