`
nicegege
  • 浏览: 589554 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

linux的top命令分析问题

 
阅读更多

今天发生数据库查询返回一半的json数据,之前以为设置c3p0的maxIdleTime为大值会解决问题,没想到问题依旧存在。

用top命令分析一下java内存:

 

[101@G3_101 bin]$ top

top - 15:58:38 up 66 days,  6:07,  2 users,  load average: 0.00, 0.00, 0.00

Tasks: 119 total,   1 running, 118 sleeping,   0 stopped,   0 zombie

Cpu(s):  0.3%us,  0.2%sy,  0.0%ni, 99.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:   3924684k total,  1378960k used,  2545724k free,   169944k buffers

Swap:  4194296k total,    23792k used,  4170504k free,   343196k cached

PID    USER    PR  NI  VIRT   RES   SHR S %cpu %mem TIME+  COMMAND

 1661 mysql     20   0 1178m 117m 3456 S  0.3    3.1     70:42.33   mysqld

24483 101       20   0 2237m 534m  12m S  0.3    13.9    1:00.40      java

24531 101       20   0 15028  1324  1004   R   0.3       0.0       0:01.20      top

    1     root      20   0 19232  1348   1192    S    0.0        0.0        0:01.12      init

 

 

从分析得出,系统内存足够多,java进程VIRT 2237m虚拟内存,VIRT=SWAP+RES , 闲置虚拟内存还有534m 。

SHR表示共享内存大小,12m。从这些判断java虚拟机不存在,内存使用率占13.9%,不存在内存不够的情况。

分析mysql 虚拟内存总大小为1178m,闲置虚拟内存117.共共享内存3456。内存使用率占3.1%,不存在内存不够的情况。

 

还爆出如下异常:

[org.springframework.web.servlet.DispatcherServlet]DispatcherServlet with name 'springMvc' processing GET request for [/nstatsback/101admin/teaching/teaching.do]
[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapping [/101admin/teaching/teaching.do] to HandlerExecutionChain with handler [com.chinaedu.nstats.controller.NStatsController@47217048] and 1 interceptor
[org.springframework.web.servlet.DispatcherServlet]Last-Modified value for [/nstatsback/101admin/teaching/teaching.do] is: -1
[org.springframework.web.bind.annotation.support.HandlerMethodInvoker]Invoking request handler method: public void com.chinaedu.nstats.controller.NStatsController.teaching(java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException
java.lang.NullPointerException
[org.springframework.jdbc.datasource.DataSourceUtils]Fetching JDBC Connection from DataSource
[com.mchange.v2.resourcepool.BasicResourcePool]trace com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7 [managed: 8, unused: 7, excluded: 0] (e.g. com.mchan                                                                                                 ge.v2.c3p0.impl.NewPooledConnection@3c7173bf)
[org.springframework.jdbc.datasource.DataSourceUtils]Returning JDBC Connection to DataSource
[com.mchange.v2.resourcepool.BasicResourcePool]trace com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7 [managed: 8, unused: 7, excluded: 0] (e.g. com.mchan.v2.c3p0.impl.NewPooledConnection@3c7173bf)
[org.springframework.jdbc.datasource.DataSourceUtils]Fetching JDBC Connection from DataSource
[com.mchange.v2.resourcepool.BasicResourcePool]trace com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7 [managed: 8, unused: 7, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@3c7173bf)
[org.springframework.jdbc.datasource.DataSourceUtils]Returning JDBC Connection to DataSource
[com.mchange.v2.resourcepool.BasicResourcePool]trace com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7 [managed: 8, unused: 7, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@3c7173bf)
[com.mchange.v2.c3p0.impl.NewProxyConnection]com.mchange.v2.c3p0.impl.NewProxyConnection@456e5122: close() called more than once.
[org.springframework.web.servlet.DispatcherServlet]Null ModelAndView returned toDispatcherServlet with name 'springMvc': assuming HandlerAdapter completed request handling
[org.springframework.web.servlet.DispatcherServlet]Successfully completed request
[com.mchange.v2.resourcepool.BasicResourcePool]Refurbishing idle resources - Mon May 04 16:16:30 CST 2015 [com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7]
[com.mchange.v2.resourcepool.BasicResourcePool]trace com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7 [managed: 8, unused: 8, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@3c7173bf)
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@3b27e6c4] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@704f8e8e] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@38a2aba4] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@704f8e8e] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@498538c1] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@3b27e6c4] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@1295eede] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@38a2aba4] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@34e920c8] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@498538c1] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@5848ddac] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@1295eede] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@403d1c18] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@34e920c8] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@5848ddac] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@403d1c18] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.resourcepool.BasicResourcePool]Refurbishing idle resources - Mon May 04 16:17:30 CST 2015 [com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7]
[com.mchange.v2.resourcepool.BasicResourcePool]trace com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7 [managed: 8, unused: 8, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@3c7173bf)
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@3b27e6c4] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@38a2aba4] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@704f8e8e] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@38a2aba4] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@704f8e8e] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@498538c1] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@3b27e6c4] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@34e920c8] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@1295eede] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@498538c1] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@5848ddac] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@34e920c8] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@403d1c18] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@5848ddac] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@1295eede] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@403d1c18] on IDLE CHECK has SUCCEEDED.
loginFilter end
update gm_login_log  SET user_id =?,  u_num =?,  ip =?,  class_id =?,  semester_code =?,  login_time =?,  school_id =?,  create_time =?,  create_user =?,  modify_time =?,  modify_user =?,  delete_flag =?,  school_code =?,   check_time =?,  stay_time =?, role_code =?  where id=?
[com.mchange.v2.resourcepool.BasicResourcePool]Checking for expired resources - Mon May 04 16:18:00 CST 2015 [com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7]
[com.mchange.v2.resourcepool.BasicResourcePool]BEGIN check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7]
[com.mchange.v2.resourcepool.BasicResourcePool]FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7]
[com.mchange.v2.resourcepool.BasicResourcePool]Refurbishing idle resources - Mon May 04 16:18:30 CST 2015 [com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7]
[com.mchange.v2.resourcepool.BasicResourcePool]trace com.mchange.v2.resourcepool.BasicResourcePool@75b67ac7 [managed: 8, unused: 8, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@3c7173bf)
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@3b27e6c4] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@38a2aba4] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@704f8e8e] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@704f8e8e] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@498538c1] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@3b27e6c4] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@1295eede] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@38a2aba4] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@34e920c8] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@498538c1] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@5848ddac] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@1295eede] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Testing PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@403d1c18] on IDLE CHECK.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@5848ddac] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@34e920c8] on IDLE CHECK has SUCCEEDED.
[com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool]Test of PooledConnection [com.mchange.v2.c3p0.impl.NewPooledConnection@403d1c18] on IDLE CHECK has SUCCEEDED.

更多linux top命令参考文章http://www.jb51.net/LINUXjishu/34604.html

 

 

Linux系统的物理cpu数、核数、逻辑cpu个数查看

 

# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 
# 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数

# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq

# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l

# 查看CPU信息(型号)
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

 

分享到:
评论

相关推荐

    linux top命令源代码

    通过分析`top-3.4`这样的源码,我们可以学习到Linux进程管理、系统资源监控、终端交互、信号处理等多个领域的知识,这对于理解和开发类似工具,或者解决系统性能问题都非常有帮助。同时,这也是对操作系统内核工作...

    Linux top 命令详解

    Linux top 命令是 Linux 下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于 Windows 的任务管理器。下面详细介绍它的使用方法。 认识 top 的显示结果 ------------------- top 命令的显示...

    Linux系统命令top,ps,kill,free,vmstat等命令的源码

    1. **top命令**:`top`是实时显示系统状态的动态视图工具,包括CPU使用率、内存使用情况、进程状态等。通过阅读源码,我们可以了解它如何获取并处理 `/proc` 目录下的系统信息,以及如何实现动态刷新和用户交互功能...

    Linux中top命令参数介绍及查询结果详细分析

    ### Linux中top命令参数介绍及查询结果详细分析 #### 一、top命令概述 `top` 命令是Linux操作系统中一个非常实用且强大的工具,它可以实时地展示系统中各个进程的资源占用情况,包括CPU使用率、内存使用量等关键...

    Linux 系统top源码包

    Linux系统中的`top`命令是系统管理员和开发者用于实时监控系统资源使用情况的重要工具,它提供了动态视图,展示CPU利用率、内存使用、进程状态等关键信息。`top`源码包的分析可以帮助我们深入了解其内部工作原理,...

    linux下top命令的使用.docx

    ### Linux 下 `top` 命令的使用详解 `top` 命令是 Linux 系统中非常重要的实时监控工具之一,主要用于查看和监控系统资源使用情况,特别是 CPU 和内存的使用情况。虽然大多数程序员都熟悉 `top` 命令的基本使用,但...

    LinuxTop命令解析.pdf

    1. **Linux top命令简介** `top`命令的主要功能是实时监控系统中每个进程的资源占用,包括CPU利用率、内存使用、进程状态等。它不仅能够列出系统中当前最消耗资源的进程,还可以按不同的指标(如CPU使用率、内存...

    linux下top命令详细简介

    top 命令是 Linux 下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于 Windows 的任务管理器。下面详细介绍它的使用方法。 系统整体的统计信息 在 top 命令的输出中,前五行是系统整体的...

    linux中top命令详解

    top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器。 top显示系统当前的进程和其他状况,是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在...

    Linux命令大全完整版.pdf

    - 进程控制命令:如kill(发送信号杀死进程)、ps(显示进程状态)、top(动态显示进程状态)等,用于管理和监控系统进程。 - 系统监控命令:如free(显示内存使用情况)、df(显示磁盘空间使用情况)、vmstat(显示...

    Linux内核分析及命令大全

    本资源包“Linux内核分析及命令大全”旨在为开发者和学习者提供全面的Linux知识,包括深入理解Linux内核的工作原理以及常用命令的使用。 《Linux内核分析》部分通常会涵盖以下知识点: 1. **Linux内核简介**:介绍...

    linux常用命令大全.pdf

    ### Linux常用命令大全 #### 一、文件管理 1. **查看目录与文件** - **ls**: 用于列出当前目录下的文件和子目录。常用选项包括: - `-l`: 以长格式显示文件详细信息,如权限、所有者、大小等。 - `-a`: 显示...

    图解linux下top命令的使用

    标题和描述中的"图解linux下top命令的使用"意味着本文将通过实例和图形解释如何使用`top`命令来监控Linux系统。 **1. top命令的基本视图解析:** - **第一行**:显示当前系统时间以及系统已运行的时间,这里的...

    linux-Linux命令大全内容包含Linux命令手册详解学习搜集

    本资源"Linux命令大全"包含了516个Linux命令的详细资料,对于学习和理解Linux操作系统至关重要。下面,我们将深入探讨这个资源中涉及的一些关键知识点。 1. **命令手册**: - 在Linux世界中,命令手册(man pages...

    Linux常用命令-API手册.zip

    本压缩包"Linux常用命令-API手册.zip"包含了两个重要的参考资料:"Linux基础命令教程豪华版.chm"和"Linux常用命令大全.chm",它们为用户提供详尽的Linux命令学习指南。 "Linux基础命令教程豪华版.chm"可能是对Linux...

    Linux系统top命令的使用方法介绍.pdf

    **Linux系统的top命令详解** 在Linux操作系统中,`top`命令是一个实时动态显示系统状态的工具,它能够提供关于系统整体性能的详细信息,包括CPU使用率、内存使用情况、进程状态以及系统负载等。通过`top`命令,管理...

    Linux命令学习+Linux标准文本处理命令

    通过学习这些基本的Linux命令和Shell操作,初学者可以更快地熟悉Linux环境,并能有效地管理和操作Linux系统。此外,掌握这些技能还有助于提升在开发、运维以及其他与Linux相关的领域的专业能力。

    Linux系统命令学习包,三天学会全部Linux命令

    系统管理命令也非常重要,如"shutdown"和"reboot"用于关机和重启,"top"或"htop"实时监控系统资源使用情况,"ps"展示进程状态,"kill"或"killall"用于结束进程。"df"和"du"分别查看磁盘空间总览和具体目录或文件占用...

    Linux常用命令全集

    本资源“Linux常用命令全集”提供了一个全面且实用的参考指南,旨在帮助用户快速查找并理解常用的Linux命令。 1. **Linux命令基础** - **ls**:列出目录内容,常用选项如 `-l` 以详细格式显示,`-a` 显示所有文件...

Global site tag (gtag.js) - Google Analytics