java - 使用 JProfiler 分析 mongodb

标签 java mongodb groovy jprofiler

我想使用 JProfiler 分析一些 mongodb 调用。我构建了一个简单的 groovy 脚本,它使用 com.mongodb 驱动程序连接到 mongodb 数据库并触发一些查询。

我按照本视频中的说明配置了 JProfiler: http://blog.ej-technologies.com/2013/07/profiling-mongodb.html

我的脚本非常简单,但我在 JProfiler 的 mongodb 选项卡中看不到任何调用。

println "Starting client "+getName()
Mongo mongo = new Mongo("mongohost", 27017)
DB db = mongo.getDB("databasename")

// get a single collection
DBCollection collection = db.getCollection("collectionname")

DBCursor cursor = collection.find()
while (cursor.hasNext()) {
cursor.next()
}
println "Client "+getName() + " finished"

你知道我错过了什么吗?

编辑: 该死...我仔细检查了 JProfiler 文档并错过了这个条目:

从版本 2.11 及更高版本开始,MongoDB 探针可与官方 MongoDB 驱动程序配合使用。

所以我将 pom 中的条目更改为版本 2.11.3,现在一切都按预期工作。

最佳答案

您可以通过将 JProfiler 集成到 IDE 来进行分析。在下面的链接中,它展示了如何将其连接到 IntelliJ。

https://medium.com/@ydulanjanii/profiling-mongodb-with-jprofiler-e3aef8860265

关于java - 使用 JProfiler 分析 mongodb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19489482/

相关文章:

javascript - 如何使用 nodeJS 从 JSON 对象中删除项目?

node.js - 如何为 GridFS 集合创建 Mongoose 模型?

javascript - 在 javascript 中增加日期,以更新 MongoDB

java - 从 Java 类自定义 Granite DS Actionscript 代码生成

java - 在 C 上工作的 send() 套接字,但从 bufferedReader 读取的 Java 没有得到响应

java - JNA 调用 C 函数

java - 如何将姓名以及电子邮件和密码添加到 firebase 数据库 android

java - 我该如何解决这个错误

groovy - 根据组 ID 将文件传递到 Nextflow 进程

groovy - 使对象在运行时不可变