---
# System prepended metadata

title: Untitled

---

Мне нужен самый быстрый mysql драйвер, тк в мой сервис льется 10к рпс постоянно и это только начало, а тот который я юзал стало разъебывать под нагрузкой.
Решил написать на го и плюсах простейшие сервера и побенчить че как, если они окажуться быстрее поставлю как мидлварь чисто в базу ходить.


Суть сервера:

сходить в базу, через prepared statement сделать select 1,
вернуть 200.

По итогу:

гошная реализация:

```
Summary:
  Success rate: 100.00%
  Total:        180.0043 secs
  Slowest:      2.5658 secs
  Fastest:      0.0003 secs
  Average:      0.0075 secs
  Requests/sec: 7999.7704

  Total data:   0 B
  Size/request: 0 B
  Size/sec:     0 B

Response time histogram:
  0.000 [1]       |
  0.257 [1437473] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.513 [2076]    |
  0.770 [153]     |
  1.027 [79]      |
  1.283 [25]      |
  1.540 [12]      |
  1.796 [20]      |
  2.053 [70]      |
  2.309 [38]      |
  2.566 [46]      |
```

ржавая:
```
Summary:
  Success rate: 100.00%
  Total:        180.0020 secs
  Slowest:      0.6177 secs
  Fastest:      0.0005 secs
  Average:      0.0016 secs
  Requests/sec: 7999.8399

  Total data:   0 B
  Size/request: 0 B
  Size/sec:     0 B

Response time histogram:
  0.000 [1]       |
  0.062 [1439953] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.124 [31]      |
  0.186 [0]       |
  0.247 [0]       |
  0.309 [0]       |
  0.371 [0]       |
  0.433 [0]       |
  0.494 [0]       |
  0.556 [0]       |
  0.618 [2]       |
  ```
  
  плюсовая идет нахуй тк я 1.5 часа ставил ебучие зависимости и оно все еще не билдится)
  
  
 upd.
 
 java:
 
 ```
 Summary:
  Success rate: 100.00%
  Total:        180.0004 secs
  Slowest:      0.3323 secs
  Fastest:      0.0006 secs
  Average:      0.0017 secs
  Requests/sec: 7999.9156

  Total data:   0 B
  Size/request: 0 B
  Size/sec:     0 B

Response time histogram:
  0.001 [1]       |
  0.034 [1439931] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.067 [0]       |
  0.100 [27]      |
  0.133 [0]       |
  0.166 [0]       |
  0.200 [0]       |
  0.233 [13]      |
  0.266 [8]       |
  0.299 [7]       |
  0.332 [1]       |

Response time distribution:
  10% in 0.0012 secs
  25% in 0.0014 secs
  50% in 0.0015 secs
  75% in 0.0018 secs
  90% in 0.0024 secs
  95% in 0.0026 secs
  99% in 0.0037 secs
  ```
  
  ## max rps 
  
  жава
  ```
   Success rate: 100.00%
  Total:        180.0014 secs
  Slowest:      0.5996 secs
  Fastest:      0.0014 secs
  Average:      0.0219 secs
  Requests/sec: 45602.1863

  Total data:   0 B
  Size/request: 0 B
  Size/sec:     0 B

Response time histogram:
  0.001 [1]       |
  0.061 [8201914] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.121 [6524]    |
  0.181 [8]       |
  0.241 [6]       |
  0.301 [0]       |
  0.360 [0]       |
  0.420 [0]       |
  0.480 [0]       |
  0.540 [0]       |
  0.600 [3]       |

Response time distribution:
  10% in 0.0190 secs
  25% in 0.0202 secs
  50% in 0.0212 secs
  75% in 0.0229 secs
  90% in 0.0252 secs
  95% in 0.0272 secs
  99% in 0.0368 secs
  ```
  
  ржава
  ```
  Summary:
  Success rate: 100.00%
  Total:        180.0013 secs
  Slowest:      3.0884 secs
  Fastest:      0.0010 secs
  Average:      0.0138 secs
  Requests/sec: 72444.0413

  Total data:   0 B
  Size/request: 0 B
  Size/sec:     0 B

Response time histogram:
  0.001 [1]        |
  0.310 [13039402] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.618 [18]       |
  0.927 [1]        |
  1.236 [474]      |
  1.545 [0]        |
  1.853 [0]        |
  2.162 [0]        |
  2.471 [0]        |
  2.780 [0]        |
  3.088 [127]      |

Response time distribution:
  10% in 0.0124 secs
  25% in 0.0128 secs
  50% in 0.0133 secs
  75% in 0.0142 secs
  90% in 0.0155 secs
  95% in 0.0167 secs
  99% in 0.0204 secs
  ```
  
  ржава jemalloc
  ```
  Summary:
  Success rate: 100.00%
  Total:        180.0013 secs
  Slowest:      1.6085 secs
  Fastest:      0.0041 secs
  Average:      0.0133 secs
  Requests/sec: 75432.7351

  Total data:   0 B
  Size/request: 0 B
  Size/sec:     0 B

Response time histogram:
  0.004 [1]        |
  0.165 [13576793] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.325 [717]      |
  0.485 [155]      |
  0.646 [0]        |
  0.806 [6]        |
  0.967 [0]        |
  1.127 [269]      |
  1.288 [36]       |
  1.448 [0]        |
  1.608 [15]       |

Response time distribution:
  10% in 0.0117 secs
  25% in 0.0122 secs
  50% in 0.0129 secs
  75% in 0.0138 secs
  90% in 0.0152 secs
  95% in 0.0162 secs
  99% in 0.0190 secs

  ```
  
  +lto + codegen_units=1
  ```
  Summary:
  Success rate: 100.00%
  Total:        180.0012 secs
  Slowest:      3.0740 secs
  Fastest:      0.0006 secs
  Average:      0.0117 secs
  Requests/sec: 85283.7187

  Total data:   0 B
  Size/request: 0 B
  Size/sec:     0 B

Response time histogram:
  0.001 [1]        |
  0.308 [15350445] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.615 [152]      |
  0.923 [26]       |
  1.230 [400]      |
  1.537 [9]        |
  1.845 [0]        |
  2.152 [0]        |
  2.459 [0]        |
  2.767 [0]        |
  3.074 [139]      |

Response time distribution:
  10% in 0.0102 secs
  25% in 0.0107 secs
  50% in 0.0114 secs
  75% in 0.0123 secs
  90% in 0.0135 secs
  95% in 0.0143 secs
  99% in 0.0168 sesc
  ```
  
    
  код на go написаный не бибизяной
  ```
  Summary:
  Success rate: 100.00%
  Total:        180.0012 secs
  Slowest:      1.6109 secs
  Fastest:      0.0005 secs
  Average:      0.0124 secs
  Requests/sec: 80473.4852

  Total data:   41.44 MiB
  Size/request: 3 B
  Size/sec:     235.76 KiB

Response time histogram:
  0.000 [1]        |
  0.162 [14372921] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.323 [85358]    |
  0.484 [19770]    |
  0.645 [5189]     |
  0.806 [1448]     |
  0.967 [436]      |
  1.128 [140]      |
  1.289 [40]       |
  1.450 [16]       |
  1.611 [5]        |

Response time distribution:
  10% in 0.0016 secs
  25% in 0.0027 secs
  50% in 0.0052 secs
  75% in 0.0114 secs
  90% in 0.0247 secs
  95% in 0.0399 secs
  99% in 0.1354 secs
  ```