View memory usage in CentOS

Source: Internet
Author: User

View memory usage in CentOS
Background

After MySQL was installed last time, tomcat + nginx was installed these days, and two small websites were run. then, continuous integration of git + jenkins can automatically publish the code on github in jenkins.
The deployed application needs to connect to the database, and an error is reported when MySQL is started:

> service mysqld startMySQL Daemon failed to start.Starting mysqld:                                          [FAILED]

No information. Find the MySQL Log File./var/log/mysqld.log. The error message is displayed:

151128 13:57:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql2015-11-28T05:57:05.845716Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2015-11-28T05:57:05.846259Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.9) starting as process 2441 ...2015-11-28T05:57:05.850492Z 0 [Note] InnoDB: PUNCH HOLE support available2015-11-28T05:57:05.850515Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2015-11-28T05:57:05.850521Z 0 [Note] InnoDB: Uses event mutexes2015-11-28T05:57:05.850529Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier2015-11-28T05:57:05.850534Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.32015-11-28T05:57:05.850539Z 0 [Note] InnoDB: Using Linux native AIO2015-11-28T05:57:05.850820Z 0 [Note] InnoDB: Number of pools: 12015-11-28T05:57:05.850936Z 0 [Note] InnoDB: Using CPU crc32 instructions2015-11-28T05:57:05.858460Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M2015-11-28T05:57:05.858517Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 122015-11-28T05:57:05.858531Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool2015-11-28T05:57:05.858547Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error2015-11-28T05:57:05.858558Z 0 [ERROR] Plugin 'InnoDB' init function returned error.2015-11-28T05:57:05.858563Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.2015-11-28T05:57:05.858569Z 0 [ERROR] Failed to initialize plugins.2015-11-28T05:57:05.858575Z 0 [ERROR] Aborting2015-11-28T05:57:05.858585Z 0 [Note] Binlog end2015-11-28T05:57:05.858641Z 0 [Note] Shutting down plugin 'CSV'2015-11-28T05:57:05.858652Z 0 [Note] Shutting down plugin 'MyISAM'2015-11-28T05:57:05.859081Z 0 [Note] /usr/sbin/mysqld: Shutdown complete151128 13:57:05 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Run the following command to view memory usage:

Free View total memory usage top view process-related CPU and memory usage

The top command: the first line: Current System Time, system running time, number of users logging on to the system, and load average is the average load of the current system, the following three values are the average processes one minute ago, five minutes ago, and 15 minutes ago. generally, when this value exceeds the number of CPUs, the CPU will be overloaded with the processes contained in the current system;

Row 2: total, which is the total number of processes in the current system; running, which is the number of processes in the current running state; sleeping, which is the number of processes in the current waiting state; stoped, indicates the number of stopped system processes; zombie indicates the number of recovered processes;

Line 3 Cpu (s): indicates the current CPU usage;

Row 4 Mem: memory size, current usage, idle memory size, and buffer usage;

Row 5 Swap: indicates that the category is the same as that of Row 4 (Mem), but this indicates the usage of Swap partition (Swap. In general, Swap partitions (Swap) are frequently used and are considered to be caused by insufficient physical memory.

Operations that can be performed after the top command is executed:P-process list in the order of CPU usage M-sort the process list in the order of memory usageN-in the order of PID size, the process list is displayed. l-Disable or enable the first line of top information. t-Disable or enable the first line of Tasks and the third line of Cpus. information Representation m-close or enable the first part of the fourth line Mem and the fifth line Swap information representation n-set the number of processes displayed in the process list s-change the screen update cycle h-Display help q-exit top

Pmap command to view memory usage of detailed processes

You can view the memory occupied by the process information based on the process, as shown below:> pmap -d pid

Postscript

We found that jenkins occupied a large amount of memory, stopped it, and restarted mysql successfully.

After jenkins1.639 installed github plugins only, there was a maven project. When no operations were performed, the memory usage reached 400 + M. I thought there was a problem ,. later, I found that the jenkins server is recommended to use 1 GB memory or above.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.