0

How to solve this issue. php codeigniter framwork Everyday our server goes down because of these issue. CPU usage 98 % Ram used 21 083 MB /usr/sbin/mysqld

  • Find the slowest query; let's work on speeding it up. [_SlowLog_](http://mysql.rjweb.org/doc.php/mysql_analysis#slow_queries_and_slowlog) – Rick James May 04 '23 at 14:32
  • @majid-lateef Additional DB information request, please. OS, Version? RAM size, # cores, any SSD or NVME devices on MySQL Host server? Post TEXT data on justpaste.it and share the links. From your SSH login root, Text results of: A) SELECT COUNT(*), sum(data_length), sum(index_length), sum(data_free) FROM information_schema.tables; B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) SHOW FULL PROCESSLIST; E) STATUS; not SHOW STATUS, just STATUS; G) SHOW ENGINE INNODB STATUS; for server workload tuning analysis to provide suggestions. – Wilson Hauck May 04 '23 at 16:51
  • @majid-lateef Post TEXT data on justpaste.it and share the links. Additional very helpful OS information includes - please, htop 1st page, if available, TERMINATE, top -b -n 1 for most active apps, top -b -n 1 -H for details on your mysql threads memory and cpu usage, ulimit -a for list of limits, iostat -xm 5 3 for IOPS by device & core/cpu count, df -h for Used - Free space by device, df -i for inode info by device, free -h for Used - Free Mem: and Swap:, cat /proc/meminfo includes VMallocUused, for server workload tuning analysis to provide suggestions. – Wilson Hauck May 04 '23 at 16:52
  • @majid-lateef Posting TEXT of last 100 lines of an ERROR log after a crash could be very helpful to analyze difficulty you are facing. Welcome to ServerFault.com – Wilson Hauck May 04 '23 at 16:53

2 Answers2

0

Well... I dont know much about ''code igniter''. But it look like a build up of connection maybe ???...

So, more details would be needed.

I would suggest you look at your ''php app'' logs as well as you MySQL logs to start with. And may be OS logs as well.

Also, there might be config suggestion for your DB settings from ''code igniter'' to optimize your performances.

Start with that I would say.

yield
  • 771
  • 1
  • 9
  • 24
0

If RAM is the problem: The quick fix is to lower innodb_buffer_pool_size in MySQL's config (possibly /etc/mysql/my.cnf). What is the current value? How much RAM on the server? Have you changed any my.cnf settings? (There may be others that are hurting.)

If CPU is the problem, locate the slowest query; let us help you optimize it. Cf: SlowLog

Rick James
  • 2,463
  • 1
  • 6
  • 13