我想使用 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/