一、获取、设置profile(profile用collection存储数据)
db.setProfilingLevel(level)  默认为100毫秒  
db.setProfilingLevel(level,slowms)


On. Includes all operations  (包含所有操作)

二、查看profile数据
db.system.profile.find() //查看所有


三、profile数据示例
{
    "op" : "insert",
    "ns" : "test.orders",
    "query" : {
       "_id" : 1,
       "cust_id" : "A123",
       "amount" : 500,
       "status" : "A"
    },
    "ninserted" : 1,
    "keyUpdates" : 0,
    "writeConflicts" : 0,
    "numYield" : 0,
    "locks" : {
          "Global" : {
             "acquireCount" : {
                "w" : NumberLong(1)
             }
          },
          "MMAPV1Journal" : {
             "acquireCount" : {
                "w" : NumberLong(2)
             }
          },
          "Database" : {
             "acquireCount" : {
                "w" : NumberLong(1)
             }
          },
          "Collection" : {
             "acquireCount" : {
                "W" : NumberLong(1)
             }
          }
       },
    ,
    "millis" : 0,
    "execStats" : {
    },
    "ts" : ISODate("2012-12-10T19:31:28.977Z"),
    "client" : "127.0.0.1",
    "allUsers" : [ ],
    "user" : ""
}


四、profile说明
1、system.profile.op
  • insert
  • query
  • update
  • remove
  • getmore
  • command

2、system.profile.ns

   命名空间:数据库名.collection名
3、system.profile.query
   查询条件
4、system.profile.command
   op为command时使用
5、system.profile.updateobj
   op为update时使用
6、system.profile.ntoreturn
   期望返回数量,query语句期望返回的数量,如limit(40)
7、system.profile.nreturned
   实际返回的数量
8、system.profile.ntoskip
   skip()方法跳过的记录数
9、system.profile.nscanned
   扫描次数,当扫描次数大于返回的数量(ntoreturn),考虑使用索引
   
nscanned和nscannedObjects区别:
   1、nscanned:根据索引扫描文档,扫描的可能返回实际返回的数量
   2、nscannedObjects:扫描完整的文档,扫描实际返回的数据
    http://stackoverflow.com/questions/13910097/explain-in-mongodb-differences-between-nscanned-and-nscannedobjects
10、system.profile.moved
   表示update操作移动的数据数量
11、system.profile.scanAndOrder
    布尔值,当为true时,表明排序未使用到索引,只有true时该字段才显示
12、system.profile.ndeleted
    删除操作影响的数据数量
13、system.profile.ninserted
    写入操作写入的数据数量
14、system.profile.nModified
    修改操作影响的数据数量
15、system.profile.responseLength
    返回的数据长度,单位为字节
16、system.profile.millis
    操作执行时间
17、system.profile.execStats
    统计信息,一般op为query有
18、system.profile.ts
    操作执行时间
19、system.profile.client
         客户端主机名或ip
20、system.profile.locks.acquireCount
        特定模式下获取锁的操作次数
14、system.profile.locks

The possible lock types are:

  • Global represents global lock.
  • MMAPV1Journal represents MMAPv1 storage engine specific lock to synchronize journal writes; for non-MMAPv1 storage engines, the mode for MMAPV1Journal is empty.
  • Database represents database lock.
  • Collection represents collection lock.
  • Metadata represents metadata lock.
  • oplog represents lock on the oplog.

The possible locking modes for the lock types are as follows:

  • R represents Shared (S) lock.
  • W represents Exclusive (X) lock.
  • r represents Intent Shared (IS) lock.
  • w represents Intent Exclusive (IX) lock.

    "locks" : {
        "Global" : {
          "acquireCount" : {
            "w" : NumberLong(1)
          }
        },
        "MMAPV1Journal" : {
          "acquireCount" : {
            "w" : NumberLong(1)
          }
        },
        "Database" : {
          "acquireCount" : {
            "W" : NumberLong(1)
          }
        }
      },

mongodb_profier的更多相关文章

随机推荐

  1. BZOJ1037 DP

    2013-11-15 21:51 原题传送门http://www.lydsy.com/JudgeOnline/problem.php?id=1037 拿到这道题想到了DP,后来发现三维无法确定的表示状 ...

  2. Makefile target dependency

    Makefile ..... all: T1 T2 T1: @echo "<===" $@ T2: @echo "<===" $@ ..... ma ...

  3. Linux nc (netcat) 详解

    Linux nc (netcat) 详解 http://blog.csdn.net/michael493439861/article/details/7445454

  4. (转)Oracle中判断某字段不为空及为空的SQL语句

    比如 insert into table a (a1,b1)values("a1",''); 对于这种情况,因为表里存的是'',其实是没有内容的,要查询这个字段,不能直接使用 se ...

  5. 使用echarts展示线状图信息的时候数据部分数据因为x轴的数据显示不全而隐藏的问题

    在使用echarts来展示数据时,因为数据很多的原因导致x轴显示不全,然后有些数据也隐藏在图表中,所以这个时候我们要在 series 中设置一个属性,让所有的数据都能够展示出来,这里我们需要添加的属性 ...

  6. src2中的alpha融合ROI

    #include <cv.h> #include <highgui.h> int main(int argc, char** argv) { IplImage *src1,*s ...

  7. pxe+kickstart 无人值守安装CentOS7.1

     CentOS6.6下PXE+Kickstart无人值守安装CentOS7.1操作系统 一.简介 1.1 什么是PXE Pxe(Pre-boot Execution Environment,预启动执行 ...

  8. 使用Derby ij客户端工具

    Derby是开源的.嵌入式的Java数据库程序,ij是Derby提供的客户端工具,相当于其他数据库提供的sqlplus工具. ij是纯Java的程序,不用安装,使用起来就像运行普通的Java应用程序一 ...

  9. sonarQube6.1 升级至6.2

    在使用sonarQube6.1一段时间后,今天才发现sonarQube6.2已经更新,为了尝鲜,我决定在本机先尝试一下,如何升级至6.2 在这里,根据站点提示的升级步骤 1.下载新版本sonarQub ...

  10. 最近项目中用到的js

    1.用字典判断数组是否有重复function ticketTypeValidate() { var ticketArr = []; var tickettype = $("div[name= ...