Mariadb odjednom padne, table crashed and should be repaired

Pozdrav narode, evo već 2-3 mjeseca imam problem da sql server odjednom padne. Dakle dobijam poruku table crashed and should be repaired ja optimizujem i repairam piše da nema nikakvih problema ali se problem nastavlja. Ne pada stalno, već jednom u 5-10 dana. Prije sam imao problema kada recimo odjednom ubacujem npr. 10-15 članaka. Kada publisham jedan za drugim izbacuje sql errore ali ne pada sql server. To sam popravio sa myisamcheck tako nekako. I ove tabele sam popravljao preko te komande i mislio sam da sam popravio ali svakih 5-10 dana sql server padne i ja ga moram ručno podići. Tada ne izbacuje nikakve errore.

Evo šta kaže u /var/log/mariadb/mariadb.log nakon što posle pada upalim server:

170925 03:16:41 mysqld_safe Number of processes running now: 0
170925 03:16:41 mysqld_safe mysqld restarted
170925  3:16:41 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 21331 ...
170925  3:16:41 InnoDB: The InnoDB memory heap is disabled
170925  3:16:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170925  3:16:41 InnoDB: Compressed tables use zlib 1.2.7
170925  3:16:41 InnoDB: Using Linux native AIO
170925  3:16:41 InnoDB: Initializing buffer pool, size = 128.0M
170925  3:16:41 InnoDB: Completed initialization of buffer pool
170925  3:16:41 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
170925  3:16:41  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
170925  3:16:42  InnoDB: Waiting for the background threads to start
170925  3:16:43 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 11931702658
170925  3:16:43 [Note] Plugin 'FEEDBACK' is disabled.
170925  3:16:43 [Note] Server socket created on IP: '0.0.0.0'.
170925  3:16:43 [Note] Event Scheduler: Loaded 0 events
170925  3:16:43 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.52-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
170925  3:16:43 [ERROR] mysqld: Table './*****_*******/****_options' is marked as crashed and should be repaired
170925  3:16:43 [ERROR] mysqld: Table './*****_*******/****_options' is marked as crashed and should be repaired
170925  3:16:43 [Warning] Checking table:   './*****_*******/****_options'
170925 03:17:04 mysqld_safe Number of processes running now: 0
170925 03:17:04 mysqld_safe mysqld restarted
170925  3:17:05 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 21399 ...
170925  3:17:05 InnoDB: The InnoDB memory heap is disabled
170925  3:17:05 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170925  3:17:05 InnoDB: Compressed tables use zlib 1.2.7
170925  3:17:05 InnoDB: Using Linux native AIO
170925  3:17:05 InnoDB: Initializing buffer pool, size = 128.0M
170925  3:17:05 InnoDB: Completed initialization of buffer pool
170925  3:17:05 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 11931702864
170925  3:17:05  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 11931703044
170925  3:17:05  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 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 $
InnoDB: Apply batch completed
170925  3:17:06  InnoDB: Waiting for the background threads to start
170925  3:17:07 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 11931703044
170925  3:17:07 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
170925  3:17:07 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
170925  3:17:07 [ERROR] mysqld: Out of memory (Needed 72499200 bytes)
170925  3:17:08 [Note] Plugin 'FEEDBACK' is disabled.
170925  3:17:10 [Note] Server socket created on IP: '0.0.0.0'.
170925  3:17:11 [Note] Event Scheduler: Loaded 0 events
170925  3:17:11 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.52-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
170925  3:17:11 [ERROR] mysqld: Table './*****_*******/****_options' is marked as crashed and should be repaired
170925  3:17:11 [ERROR] mysqld: Table './*****_*******/****_options' is marked as crashed and should be repaired
170925  3:17:11 [ERROR] mysqld: Table './*****_*******/****_options' is marked as crashed and should be repaired
170925  3:17:11 [ERROR] mysqld: Table './*****_*******/****_options' is marked as crashed and should be repaired
170925  3:17:11 [Warning] Checking table:   './*****_*******/****_options'
170925  3:17:17 [ERROR] mysqld: Table './*****_*******/****_posts' is marked as crashed and should be repaired
170925  3:17:17 [Warning] Checking table:   './*****_*******/****_posts'
170925  3:17:20 [ERROR] mysqld: Table './*****_*******/****_terms' is marked as crashed and should be repaired
170925  3:17:20 [Warning] Checking table:   './*****_*******/****_terms'
170925  3:17:20 [ERROR] mysqld: Table './*****_*******/****_term_taxonomy' is marked as crashed and should be repaired
170925  3:17:20 [Warning] Checking table:   './*****_*******/****_term_taxonomy'
170925 03:17:21 mysqld_safe Number of processes running now: 0
170925 03:17:21 mysqld_safe mysqld restarted
170925  3:17:21 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 21443 ...
170925  3:17:21 InnoDB: The InnoDB memory heap is disabled
170925  3:17:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170925  3:17:21 InnoDB: Compressed tables use zlib 1.2.7
170925  3:17:21 InnoDB: Using Linux native AIO
170925  3:17:21 InnoDB: Initializing buffer pool, size = 128.0M
170925  3:17:21 InnoDB: Completed initialization of buffer pool
170925  3:17:21 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
170925  3:17:21  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
170925  3:17:21  InnoDB: Waiting for the background threads to start
170925  3:17:22 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 11935593865
170925  3:17:22 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
170925  3:17:22 [Note] Plugin 'FEEDBACK' is disabled.
170925  3:17:22 [Note] Server socket created on IP: '0.0.0.0'.
170925  3:17:22 [Note] Event Scheduler: Loaded 0 events
170925  3:17:22 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.52-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
170925  3:17:23 [ERROR] mysqld: Table './*****_*******/****_options' is marked as crashed and should be repaired
170925  3:17:23 [Warning] Checking table:   './*****_*******/****_options'
170925  3:17:23 [ERROR] mysqld: Table './*****_*******/****_term_taxonomy' is marked as crashed and should be repaired
170925  3:17:23 [Warning] Checking table:   './*****_*******/****_term_taxonomy'
170925  3:17:23 [ERROR] mysqld: Table './*****_*******/****_term_relationships' is marked as crashed and should be repaired
170925  3:17:23 [Warning] Checking table:   './*****_*******/****_term_relationships'
170925  3:17:23 [ERROR] mysqld: Table './*****_*******/****_postmeta' is marked as crashed and should be repaired
170925  3:17:23 [Warning] Checking table:   './*****_*******/****_postmeta'
170925  3:17:24 [ERROR] mysqld: Table './*****_*******/****_usermeta' is marked as crashed and should be repaired
170925 03:17:25 mysqld_safe Number of processes running now: 0
170925 03:17:25 mysqld_safe mysqld restarted
170925  3:17:25 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 21491 ...
170925  3:17:25 InnoDB: The InnoDB memory heap is disabled
170925  3:17:25 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170925  3:17:25 InnoDB: Compressed tables use zlib 1.2.7
170925  3:17:25 InnoDB: Using Linux native AIO
170925  3:17:25 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
170925  3:17:25 InnoDB: Completed initialization of buffer pool
170925  3:17:25 InnoDB: Fatal error: cannot allocate memory for the buffer pool
170925  3:17:25 [ERROR] Plugin 'InnoDB' init function returned error.
170925  3:17:25 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170925  3:17:25 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
170925  3:17:25 [Note] Plugin 'FEEDBACK' is disabled.
170925  3:17:25 [ERROR] Unknown/unsupported storage engine: InnoDB
170925  3:17:25 [ERROR] Aborting

170925  3:17:25 [Note] /usr/libexec/mysqld: Shutdown complete

170925 03:17:26 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
170925 13:18:40 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170925 13:18:40 [Note] /usr/libexec/mysqld (mysqld 5.5.52-MariaDB) starting as process 22463 ...
170925 13:18:40 InnoDB: The InnoDB memory heap is disabled
170925 13:18:40 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170925 13:18:40 InnoDB: Compressed tables use zlib 1.2.7
170925 13:18:40 InnoDB: Using Linux native AIO
170925 13:18:40 InnoDB: Initializing buffer pool, size = 128.0M
170925 13:18:40 InnoDB: Completed initialization of buffer pool
170925 13:18:40 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 11935593865
170925 13:18:40  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 11935593875
170925 13:18:40  InnoDB: Waiting for the background threads to start
170925 13:18:41 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 11935593875
170925 13:18:41 [Note] Plugin 'FEEDBACK' is disabled.
170925 13:18:41 [Note] Server socket created on IP: '0.0.0.0'.
170925 13:18:41 [Note] Event Scheduler: Loaded 0 events
170925 13:18:41 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.52-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server

server ima 4 gb rama i u prosjeku je zauzeto 1,5 gb ali cini mi se da u određenim momentima skoči strašno zauzeće rama

Ima li neko stručan da mi kaže šta mi je raditi?

edit: evo grafika šta se desi kad padne

opterećenje servera

ram

sql

Povecaj buffer memory - sad je 128 Mb koliko vidim.

hvala na odgovoru, evo šta sam uradio, stavio u /etc/my.cnf ovu liniju

innodb_buffer_pool_size = 3200M

negdje sam vidio da na serverima sa malom kolicinom rama treba stavljati buffer pool size 80% od ukupne memorije

i dodao sam swap file od 4 gb pomocu ovoga

vidjet ćemo šta će biti

edit:

evo sad pratim stanje preko htopa i opet je došlo do nekih oscilacija, u sql logu nema ništa novo ali se pojavilo nešto u swapu, ako bude swap radio svoj posao bit će dobro

opet je došlo do preoptrećenja sql servera kao u toku noći kada je pao ali sada nije pao, valjda je to swap popravio neam pojma xd

swap fajl sam obrisao jer sam negdje vidio da swap na ssdu dugorocno steti hardware, ovu liniju sto sam ubacio u /etc/my.cnf sam obrisao jer se nakon sto ubacim tu liniju sql server neće da pokrene, jedino se pokrene kada kompletan vps restartujem ali onda se pomalo povecava zauzece rama, jutros bilo 1.5 GB sada doslo do 2.9 GB

samo cekam da prodje ovaj val posjeta pa cu preci sa apache + nginx sistema na nginx + php-fpm uz pomoć ovoga

pa ćemo vidjet šta će biti