Мой сервер сегодня сломался. Он построен вокруг Threadripped 3960x, с 126 ГБ оперативной памяти. На Ubuntu он запускает MySQL, SphinxSearch и многопоточные Python сценарии.
В настоящее время я выделяю 60 ГБ для буферного пула InnoDB, 10 ГБ для MyIsam, индексы SphinxSearch составляют 46 ГБ. Python "вероятно" понадобится что-то вроде 12G для запуска задач, которые мне нужно выполнить.
MySQLTuner говорит, что с памятью все в порядке (как будто Sphinx не беспокоит ее). Когда я пишу этот пост, Glances сообщает о 39,6 ГБ свободной памяти (36,8 ГБ кэшировано; 1,4 ГБ из 4 ГБ использованного SWAP). Так что все выглядит красиво. И все же он разбился, и я увидел ошибки сегментации. Более того, после увеличения размера пула InnoDB для размещения новой таблицы largi sh (теперь вернулся к 60G и с тех пор проблем нет, но пока рано говорить.
Обычное предложение для * Сервер 1037 *, чтобы выделить 75% + доступной оперативной памяти для пула (96 ГБ в моем случае), что нецелесообразно, когда другие процессы конкурируют за оперативную память.
Я не смог найти исчерпывающего обсуждения относительно выделения памяти когда платформа используется в контексте науки о данных.
Полезные источники?
[РЕДАКТИРОВАТЬ]
Хотя это в значительной степени не имеет значения, поскольку это не имеет ничего общего с моим фактическим Вопрос (где найти обсуждение относительно выделения ОЗУ для рабочей станции по науке о данных), ниже частично отредактированный вывод MySQLTuner.
1 [!!] Currently running unsupported MySQL version 8.0.19-0ubuntu0.19.10.3
2 [OK] Operating on 64-bit architecture
3
4 -------- Log file Recommendations ------------------------------------------------------------------
5 [OK] /var/log/mysql/error.log doesn't contain any error.
6
7 -------- Storage Engine Statistics -----------------------------------------------------------------
8 [--] Data in MRG_MYISAM tables: 351.0G (Tables: 2)
9 [--] Data in MyISAM tables: 589.1G (Tables: 131)
10 [--] Data in InnoDB tables: 103.9G (Tables: 5)
11 [OK] Total fragmented tables: 0
12
13 -------- Performance Metrics -----------------------------------------------------------------------
14 [--] Up for: 1d 4h 42m 38s (4M q [42.365 qps], 869K conn, TX: 2G, RX: 8G)
15 [--] Reads / Writes: 0% / 100%
16 [--] Binary logging is disabled
17 [--] Physical Memory : 125.7G
18 [--] Max MySQL memory : 81.6G
19 [--] Other process memory: 9.1G
20 [--] Total buffers: 74.0G global + 19.3M per thread (400 max threads)
21 [OK] Maximum reached memory usage: 74.9G (59.57% of installed RAM)
22 [OK] Maximum possible memory usage: 81.6G (64.87% of installed RAM)
23 [OK] Overall possible memory usage with other process is compatible with memory available
24 [OK] Slow queries: 0% (0/4M)
25 [OK] Highest usage of available connections: 11% (46/400)
26 [OK] Aborted connections: 0.00% (5/869580)
27 [OK] Sorts requiring temporary tables: 3% (29 temp sorts / 766 sorts)
28 [OK] No joins without indexes
29 [OK] Temporary tables created on disk: 0% (0 on disk / 948 total)
30 [OK] Thread cache hit rate: 99% (46 created / 869K connections)
31 [!!] Table cache hit rate: 10% (628 open / 6K opened)
32 [OK] Open file limit used: 2% (219/10K)
33 [OK] Table locks acquired immediately: 99% (60K immediate / 60K locks)
34
35 -------- MyISAM Metrics ----------------------------------------------------------------------------
36 [!!] Key buffer used: 26.5% (2B used / 10B cache)
37 [OK] Key buffer size / total MyISAM indexes: 10.0G/210.8G
38 [OK] Read Key buffer hit rate: 99.2% (676M cached / 5M reads)
39 [!!] Write Key buffer hit rate: 11.0% (96M cached / 10M writes)
40
41 -------- InnoDB Metrics ----------------------------------------------------------------------------
42 [--] InnoDB is enabled.
43 [--] InnoDB Thread Concurrency: 0
44 [OK] InnoDB File per table is activated
45 [!!] InnoDB buffer pool / data size: 64.0G/103.9G
46 [!!] Ratio InnoDB log file size / InnoDB Buffer pool size (18.75 %): 6.0G * 2/64.0G should be equal 25%
47 [OK] InnoDB buffer pool instances: 64
48 [--] Number of InnoDB Buffer Pool Chunk : 512 for 64 Buffer Pool Instance(s)
49 [OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
50 [OK] InnoDB Read buffer efficiency: 99.91% (2063007809 hits/ 2064876225 total)
51 [OK] InnoDB Write log efficiency: 97.25% (325355628 hits/ 334571627 total)
52 [OK] InnoDB log waits: 0.00% (0 waits / 9215999 writes)
53
54 -------- Recommendations ---------------------------------------------------------------------------
55 General recommendations:
56 Control warning line(s) into /var/log/mysql/error.log file
57 Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
58 Increase table_open_cache gradually to avoid file descriptor limits
59 Read this before increasing table_open_cache over 64:
60 Read this before increasing for MariaDB https://mariadb.com/kb/en/library/optimizing-table_open_cache/
61 This is MyISAM only table_cache scalability problem, InnoDB not affected.
62 See more details here: https://bugs.mysql.com/bug.php?id=49177
63 This bug already fixed in MySQL 5.7.9 and newer MySQL versions.
64 Beware that open_files_limit (10000) variable
65 should be greater than table_open_cache (1000)
66 Before changing innodb_log_file_size and/or innodb_log_files_in_group read this:
67 Variables to adjust:
68 table_open_cache (> 1000)
69 innodb_buffer_pool_size (>= 103.9G) if possible.
70 innodb_log_file_size should be (=8G) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
[EDIT 2]
Добавлен частично отредактирован MySQL globals & Glances и SWAP / Paging stats, отобранные SYSSTAT. Обратите внимание, возможно, относительно большое распределение SWAP (68G). Скорее всего, много «потраченного впустую» пространства, но так как у меня большой a крепление места на диске, не беспокойтесь. Очевидно, чрезмерно, но будет корректироваться на основе статистики SWAP / подкачки. Не глядит «предупреждение» относительно давления памяти. Вероятно, признак того, что предупреждение предполагает 8 ГБ машины. Также обратите внимание, что MyQQLtuner предлагает буфер 100G + innoDB, что нереально c. Но, тем не менее, мне бы хотелось, чтобы это было выше нынешних 60G. Хранилище NVMe RAID0 (7 + ГБ / с) (с обычным rsyn c ())
Статистика пейджинга
08:35:01 AM pswpin/s pswpout/s
08:45:01 AM 0.05 0.04
08:55:01 AM 0.05 0.00
09:05:01 AM 0.04 0.00
09:15:01 AM 0.04 0.01
09:25:01 AM 0.04 0.01
09:35:01 AM 0.03 0.02
Статистика памяти SWAP
08:35:01 AM kbswpfree kbswpused %swpused kbswpcad %swpcad
08:45:01 AM 67.4G 652.5M 0.9% 137.2M 21.0%
08:55:01 AM 67.4G 652.5M 0.9% 137.2M 21.0%
09:05:01 AM 67.4G 652.5M 0.9% 137.2M 21.0%
09:15:01 AM 67.4G 652.2M 0.9% 137.1M 21.0%
09:25:01 AM 67.4G 652.2M 0.9% 137.2M 21.0%
Отчет о взглядах
pop-os (Ubuntu 19.10 64bit / Linux 5.3.0-7642-generic) - IP 192.168.2.11/24 Pub xxx.xxx.xxx.xxx Uptime: 2 days, 22:40:52
CPU [ 0.5%] CPU - 0.5% nice: 0.0% ctx_sw: 3K GPU GeForce GTX 1 MEM - 71.6% SWAP - 0.9% LOAD 48-core
MEM [ 71.6%] user: 0.4% irq: 0.0% inter: 2371 proc: 0% total: 126G total: 68.0G 1 min: 0.37
SWAP [ 0.9%] system: 0.1% iowait: 0.0% sw_int: 879 mem: 4% used: 90.1G used: 637M 5 min: 0.33
idle: 99.5% steal: 0.0% free: 35.6G free: 67.4G 15 min: 0.29
NETWORK Rx/s Tx/s TASKS 581 (1007 thr), 1 run, 350 slp, 230 oth sorted automatically by memory consumption
enp68s0 4Kb 1Kb
lo 264b 264b CPU% MEM% VIRT RES PID USER TIME+ THR NI S R/s W/s Command
0.3 62.9 90.0G 79.1G 1661 mysql 12h14:52 161 0 S ? ? /usr/sbin/mysqld
DefaultGateway 31ms 0.3 6.0 51.1G 7.50G 57191 analyst 10:04 81 0 S 0 0 /home/analyst/sphinx-3.2.1/bin/searchd
22.0 0.5 2.55G 669M 39164 analyst 4h48:08 1 0 R 0 1K /usr/bin/python3 /usr/bin/glances
DISK I/O R/s W/s 0.0 0.1 2.79G 71.4M 1815 gdm 1:15 12 0 S ? ? /usr/bin/gnome-shell
dm-0 0 0 0.3 0.0 2.50G 58.0M 59975 analyst 0:05 34 0 S 0 0 /usr/bin/python3 /home/analyst/.vim/bu
md126 0 0 0.0 0.0 159M 27.9M 840 root 0:02 1 -1 S ? ? /lib/systemd/systemd-journald
md127 0 0 0.0 0.0 175M 23.8M 1685 gdm 0:05 2 0 S ? ? /usr/lib/xorg/Xorg vt1 -displayfd 3 -a
nvme0n1 0 0 0.0 0.0 2.23G 14.9M 59972 analyst 0:13 32 0 S 0 0 vim _getComments.py
nvme0n1p1 0 0 0.0 0.0 348M 8.98M 2048 gdm 0:00 4 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-key
nvme1n1 0 0 0.0 0.0 178M 8.95M 84003 root 0:00 3 0 S ? ? /usr/sbin/cups-browsed
nvme1n1p1 0 0 0.0 0.0 32.6M 8.89M 109769 root 0:00 1 0 S ? ? mysql
nvme2n1 0 0 0.0 0.0 40.2M 8.79M 60015 analyst 0:00 1 0 S 0 0 /usr/bin/python3 /home/analyst/.vim/bu
nvme2n1p1 0 0 0.0 0.0 18.7M 8.72M 109332 root 0:00 1 0 S ? ? sshd: analyst [priv]
nvme3n1 0 0 0.0 0.0 18.7M 8.10M 82827 root 0:00 1 0 S ? ? sshd: analyst [priv]
nvme3n1p1 0 0 0.0 0.0 1.86G 7.64M 1497 root 0:03 1 0 S ? ? /usr/bin/python3 /usr/bin/glances -s
nvme4n1 0 1K 0.0 0.0 18.7M 7.17M 76386 root 0:00 1 0 S ? ? sshd: analyst [priv]
nvme4n1p1 0 0 0.0 0.0 47.2M 7.11M 1397 root 0:00 1 0 S ? ? /usr/bin/python3 /usr/bin/networkd-dis
nvme4n1p2 0 0 0.0 0.0 341M 7.08M 1433 root 0:04 3 0 S ? ? /usr/sbin/NetworkManager --no-daemon
nvme4n1p3 0 1K 0.0 0.0 165M 7.04M 1 root 0:13 1 0 S ? ? /sbin/init splash
nvme4n1p4 0 0 0.0 0.0 385M 6.98M 1434 root 0:00 5 0 S ? ? /usr/lib/udisks2/udisksd
nvme5n1 0 0 0.0 0.0 502M 6.88M 2032 gdm 0:00 4 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-col
nvme5n1p1 0 0 0.0 0.0 18.7M 6.58M 59923 root 0:00 1 0 S ? ? sshd: analyst [priv]
nvme6n1 0 0 0.0 0.0 111M 6.57M 84002 root 0:00 1 0 S ? ? /usr/sbin/cupsd -l
nvme6n1p1 0 0 0.0 0.0 18.7M 6.50M 60098 root 0:00 1 0 S ? ? sshd: analyst [priv]
0.0 0.0 348M 6.47M 2045 gdm 0:00 4 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-pow
FILE SYS Used Total 0.0 0.0 19.1M 6.45M 109364 analyst 0:00 1 0 S ? ? 3
/ (nvme4n1p3) 454G 908G 0.0 0.0 250M 6.40M 2103 colord 0:00 3 0 S ? ? /usr/lib/colord/colord
/BU (md127) 560G 1.83T 0.0 0.0 230M 6.35M 1517 root 0:02 3 0 S ? ? /usr/lib/policykit-1/polkitd --no-debu
/data (md126) 609G 1.79T 0.0 0.0 753M 6.20M 2053 gdm 0:00 4 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-med
/recovery (nvme4n1p2) 2.36G 3.99G 0.0 0.0 18.7M 6.00M 39114 root 0:00 1 0 S ? ? sshd: analyst [priv]
0.0 0.0 19.1M 5.88M 82859 analyst 0:00 1 0 S ? ? 5
RAID disks Used Avail 0.0 0.0 411M 5.37M 1805 gdm 0:00 4 0 S ? ? /usr/lib/gnome-session/gnome-session-b
RAID0 md126 2 - 0.0 0.0 19.1M 5.33M 76419 analyst 0:00 1 0 S ? ? 4
RAID0 md127 4 - 0.0 0.0 306M 5.24M 1432 root 0:00 3 0 S ? ? /usr/sbin/ModemManager --filter-policy
0.0 0.0 256M 5.24M 1965 root 0:00 3 0 S ? ? /usr/lib/upower/upowerd
SENSORS 0.0 0.0 223M 5.20M 38840 analyst 0:00 3 -11 S 0 0 /usr/bin/pulseaudio --daemonize=no
SYSTIN 28C 0.0 0.0 243M 5.12M 1576 root 0:00 3 0 S ? ? /usr/sbin/gdm3
CPUTIN 33C 0.0 0.0 348M 5.11M 2033 gdm 0:01 4 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-xse
Tdie 46C 0.0 0.0 20.1M 5.08M 109365 analyst 0:00 1 0 S 0 0 -bash
Tctl 46C 0.0 0.0 345M 4.94M 2145 gdm 0:00 3 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-pri
0.0 0.0 26.6M 4.89M 109768 root 0:00 1 0 S ? ? sudo mysql
0.0 0.0 14.8M 4.87M 84036 lp 0:00 1 0 S ? ? /usr/lib/cups/notifier/dbus dbus://
0.0 0.0 20.1M 4.86M 82860 analyst 0:00 1 0 S 0 0 -bash
0.0 0.0 178M 4.83M 1653 root 0:00 3 0 S ? ? gdm-launch-environment]
0.0 0.0 19.1M 4.83M 59958 analyst 0:00 1 0 S ? ? 0
0.0 0.0 347M 4.80M 1982 gdm 0:00 4 0 S ? ? /usr/lib/ibus/ibus-x11 --kill-daemon
0.0 0.0 20.1M 4.74M 76420 analyst 0:00 1 0 S 0 0 -bash
0.0 0.0 347M 4.73M 2035 gdm 0:00 4 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-wac
0.0 0.0 19.1M 4.73M 60130 analyst 0:09 1 0 S ? ? 1
0.0 0.0 19.0M 4.52M 39152 analyst 0:07 1 0 S ? ? 2
0.0 0.0 9.68M 4.47M 1412 messagebu 0:04 1 0 S ? ? /usr/bin/dbus-daemon --system --addres
0.0 0.0 243M 4.44M 1436 root 0:02 3 0 S ? ? /usr/lib/accountsservice/accounts-daem
0.0 0.0 20.4M 4.43M 1383 systemd-r 0:53 1 0 S ? ? /lib/systemd/systemd-resolved
0.0 0.0 252M 4.38M 2031 gdm 0:00 3 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-pri
0.0 0.0 242M 4.20M 2339 root 0:00 3 0 S ? ? /usr/lib/bolt/boltd
0.0 0.0 18.4M 3.82M 2310 analyst 0:00 1 0 S 0 0 /lib/systemd/systemd --user
0.0 0.0 267M 3.74M 1774 gdm 0:00 4 0 S ? ? /usr/lib/gnome-session/gnome-session-b
0.0 0.0 16.2M 3.68M 1431 root 0:00 1 0 S ? ? /lib/systemd/systemd-logind
0.0 0.0 350M 3.65M 1388 root 0:03 6 0 S ? ? /usr/bin/pop-upgrade daemon
0.0 0.0 317M 3.43M 2029 gdm 0:00 5 0 S ? ? /usr/lib/gnome-settings-daemon/gsd-sma
High memory consumption
2020-04-09 08:03:30 (ongoing) - MEM (71.7)
MySQL глобалы
------------------------------------------------------------------+
| Variable_name | Value
+-------------------------------------------------------+-----------------| Aborted_clients | 9
| Aborted_connects | 7
| Bytes_received | 15128841585
| Bytes_sent | 3894567345
| Com_admin_commands | 2326733
| Com_begin | 5
| Com_change_db | 384
| Com_commit | 64448
| Com_create_db | 1
| Com_create_table | 432
| Com_delete | 202
| Com_drop_table | 420
| Com_flush | 7
| Com_insert | 2289982
| Com_insert_select | 116
| Com_load | 109
| Com_lock_tables | 18
| Com_rename_table | 1
| Com_select | 11127
| Com_set_option | 6955771
| Com_show_create_func | 3
| Com_show_create_table | 667
| Com_show_databases | 28
| Com_show_engine_status | 4
| Com_show_fields | 835
| Com_show_function_status | 26
| Com_show_keys | 17
| Com_show_procedure_status | 23
| Com_show_processlist | 38
| Com_show_slave_hosts | 1
| Com_show_slave_status | 1
| Com_show_status | 4
| Com_show_storage_engines | 1
| Com_show_table_status | 368
| Com_show_tables | 46
| Com_show_triggers | 360
| Com_show_variables | 28
| Com_truncate | 36
| Com_unlock_tables | 15
| Com_update | 25421
| Com_update_multi | 168
| Connections | 2317785
| Created_tmp_files | 326
| Created_tmp_tables | 1928
| Current_tls_ca | ca.pem
| Current_tls_cert | server-cert.pem
| Current_tls_key | server-key.pem
| Current_tls_version | TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
| Flush_commands | 6
| Handler_commit | 2274457
| Handler_delete | 27812140
| Handler_external_lock | 67855375
| Handler_read_first | 12790
| Handler_read_key | 391325575
| Handler_read_last | 373
| Handler_read_next | 664372409
| Handler_read_prev | 61672829
| Handler_read_rnd | 58877032
| Handler_read_rnd_next | 3293654196
| Handler_update | 253770790
| Handler_write | 301001614
| Innodb_buffer_pool_dump_status | Dumping of buffer pool not started
| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 200406 17:06:16
| Innodb_buffer_pool_pages_data | 3678440
| Innodb_buffer_pool_bytes_data | 60267560960
| Innodb_buffer_pool_pages_flushed | 29131111
| Innodb_buffer_pool_pages_free | 66018
| Innodb_buffer_pool_pages_misc | 449846
| Innodb_buffer_pool_pages_total | 4194304
| Innodb_buffer_pool_read_ahead | 468754
| Innodb_buffer_pool_read_ahead_evicted | 184556
| Innodb_buffer_pool_read_requests | 2964325318
| Innodb_buffer_pool_reads | 6052218
| Innodb_buffer_pool_wait_free | 1343
| Innodb_buffer_pool_write_requests | 339070408
| Innodb_data_fsyncs | 6189745
| Innodb_data_pending_fsyncs | 47
| Innodb_data_read | 178272179200
| Innodb_data_reads | 10881128
| Innodb_data_writes | 42038814
| Innodb_data_written | 998294239744
| Innodb_dblwr_pages_written | 29131192
| Innodb_dblwr_writes | 329933
| Innodb_log_write_requests | 289208990
| Innodb_log_writes | 12317906
| Innodb_os_log_fsyncs | 54945
| Innodb_os_log_written | 29770651136
| Innodb_page_size | 16384
| Innodb_pages_created | 983218
| Innodb_pages_read | 10881093
| Innodb_pages_written | 29131333
| Innodb_rows_inserted | 28771085
| Innodb_rows_read | 3341654628
| Innodb_rows_updated | 58409363
| Innodb_system_rows_deleted | 5860
| Innodb_system_rows_inserted | 6255
| Innodb_system_rows_read | 154443
| Innodb_system_rows_updated | 1127
| Innodb_num_open_files | 152
| Innodb_undo_tablespaces_total | 2
| Innodb_undo_tablespaces_implicit | 2
| Innodb_undo_tablespaces_active | 2
| Key_blocks_unused | 8467954
| Key_blocks_used | 7529603
| Key_read_requests | 2466462788
| Key_reads | 16762725
| Key_write_requests | 268675258
| Key_writes | 43521415
| Max_used_connections | 48
| Max_used_connections_time | 2020-04-09 04:10:02
| Mysqlx_address | ::
| Mysqlx_port | 33060
| Mysqlx_socket | /var/run/mysqld/mysqlx.sock
| Mysqlx_ssl_ctx_verify_depth | 18446744073709551615
| Mysqlx_ssl_ctx_verify_mode | 5
| Mysqlx_ssl_server_not_after | Feb 23 07:05:50 2030 GMT
| Mysqlx_ssl_server_not_before | Feb 26 07:05:50 2020 GMT
| Mysqlx_worker_threads | 2
| Open_files | 196
| Open_table_definitions | 262
| Open_tables | 433
| Opened_files | 196
| Opened_table_definitions | 1342
| Opened_tables | 14379
| Performance_schema_session_connect_attrs_longest_seen | 206
| Queries | 17248784
| Questions | 11669042
| Select_full_join | 145
| Select_range | 316
| Select_scan | 3634
| Sort_merge_passes | 130
| Sort_rows | 4489141
| Sort_scan | 1862
| Ssl_accepts | 2317707
| Ssl_ctx_verify_depth | 18446744073709551615
| Ssl_ctx_verify_mode | 5
| Ssl_finished_accepts | 2317706
| Ssl_server_not_after | Feb 23 07:05:50 2030 GMT
| Ssl_server_not_before | Feb 26 07:05:50 2020 GMT
| Ssl_session_cache_mode | SERVER
| Ssl_session_cache_size | 128
| Ssl_used_session_cache_entries | 18
| Table_locks_immediate | 67009
| Table_locks_waited | 132
| Table_open_cache_hits | 33915254
| Table_open_cache_misses | 14379
| Table_open_cache_overflows | 10555
| Threads_cached | 45
| Threads_connected | 3
| Threads_created | 48
| Threads_running | 2
| Uptime | 251184
| Uptime_since_flush_status | 251184