一、获取、设置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. 【LuoguP1169 bzoj1057】[ZJOI2007]棋盘制作

    首先把矩阵转化一下,把横纵坐标和为偶数点的值取反,这样就转化成求最大的'0'或'1'矩阵. 这道题每个数字是在格子内的,不能在边界包含障碍点. 求最大的0矩阵时,把1作为障碍点.求1同理. 然后求最接 ...

  2. VC6.0显示行号的插件

    VC6.0显示行号的插件,很好很强大的显行号插件,使用VC编程的朋友再也不用烦恼VC6.0没有行号的编程环境了. VC显示行号插件使用说明:1. 如果你的VC安装在C盘,请拷贝文件VC6LineNum ...

  3. Chrome浏览器跨域插件

    Moesif Origin & CORS Changer 这个插件允许发送跨域请求,重写Request Origin 和 CORS headers. 解决Debug Javascript时候出 ...

  4. Backbone Model 源码简谈 (版本:1.1.0 基础部分完毕)

    Model工厂   作为model的主要函数,其实只有12行,特别的简练 var Model = Backbone.Model = function(attributes, options) { va ...

  5. Git-回滚操作

    git revert是用一次新的commit来回滚之前的commit,git reset是直接删除指定的commit git log 查询回滚版本唯一commit标识代码 git reset --ha ...

  6. js加载条

    <html xmlns="http://www.w3.org/1999/xhtml"><head>    <meta http-equiv=" ...

  7. C++类中引用成员和常量成员的初始化(初始化列表)

    如果一个类是这样定义的: Class A { public: A(int pram1, int pram2, int pram3); privite: int a; int &b; const ...

  8. SFTP获取数据文件

    使用SFTP:客户端从服务端获取数据文件 客户机: 用户:client IP:13.00.00.11 服务端: 用户:server IP:16.00.00.66 1.在客户端的根目录下,执行下面的命令 ...

  9. vue学习记录:vue引入,validator验证,数据信息,vuex数据共享

    最近在学习vue,关于学习过程中所遇到的问题进行记录,包含vue引入,validator验证,数据信息,vuex数据共享,传值问题记录 1.vue 引入vue vue的大致形式如下: <temp ...

  10. AC日记——[Noi2011]阿狸的打字机 bzoj 2434

    2434 思路: 构建ac自动机: 抽离fail树: 根据字符串建立主席树: 在线处理询问: 询问x在y中出现多少次,等同于y有多少字母的fail能走到x: 1a,hahahahah: 代码: #in ...