I've now made slightly more significant changes. I'll now cover them briefly.
The minimum JMeter version is now 2.8, this is because it is dependent on a change introduce in JMeter 2.8.
I've created a MongoSourceElement which is accessible from the context menu; Add -> Config Element -> MongoDB Source Config
This pulls all the MongoDB connection details up a level and allows you to share it between multiple MongoScriptSamplers. This means you only need to define the connection once and associate a source name with the instance. When you create a MongoScriptSampler you can then reference the source name as defined in MongoSourceElement.
MongoScriptSampler now only includes the fields that you need. It allows you to specify the mongo source, the database, the database credentials and of course the script to run.
The way I'm currently using it is to create a MongoSourceElement.
Under that I create a ThreadGroup.
And under that I add the MongoDB Script v2.0, View Results Tree, and Graph Results.
If I have multiple script to run, I use the same grouping of, MongoDB Script v2.0, View Results Tree, and Graph Results. See the image below for an example.
There is the added MongoUtils class which has a static method which allows you to specify multiple hosts (if you want) and breaks it out into each host and port, returning an
The other semi-useful addition is the QuickEnvironment. It basically allows you to start up mongod, mongo, jmeter and a tail of the jmeter log. You could do this in a script, but hey ho, I did it in a helper class.
The latest version is available on github.
Please have a play, try and break it, make suggestions, give me feedback.
Hello Jan,
ReplyDeleteWith this new config element your plugin is much more powerful.
This is an issue I found:
If I connect to MongoDB not providing username and password everything works excellent.
If I have to provide credentials, I am getting this error for the next mongo sample (in logs and sample response):
2013/01/24 12:18:20 WARN - jan.mongometer.sampler.MongoScriptSampler: java.lang.IllegalStateException: can't call authenticate twice on the same DBObject
at com.mongodb.DB.authenticate(DB.java:489)
at jan.mongometer.mongo.MongoDB.getDB(MongoDB.java:46)
at jan.mongometer.sampler.MongoScriptSampler.sample(MongoScriptSampler.java:55)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:426)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:255)
at java.lang.Thread.run(Unknown Source)
I tried to set SocketKeepAlive to False, I tried to send credentials only with the first sample, leaving cred fields empty for the next sample(s), but getting the same error.
Maybe you have any suggestions?
Hi archie.
DeleteCould you send me the jmx file you're using please - obviously with the credentials obfuscated.
I'll fix it over the weekend.
Actually, try it now. I've added a check to see if the connection has already been authenticated.
DeleteHello Jan,
DeleteYes, it works now.
Excellent extension!
Thank you very much for it.
No problem. Let me know if there is anything else you think may be useful.
DeleteHello Jan,
ReplyDeleteJust want to thank you once more for the work you have done.
It is excellent extension!
Thank you for taking the time to say that; it's appreciated.
DeleteThis extension is now available as part of the core application, so if you download the latest (nightly) build, #mongometer is already there. Not sure on the timetable with regards to the next major/minor #jmeter release.
If you have any requests for additional functionality, I'll be happy to take a look.
Hi ,
ReplyDeleteVery nice work .
I had a question . I was unable to get the authentication thing working . tried to follow the png's that you have posted . I get this error
command failed [command failed [$eval] { "serverUsed" : "xxx.xxx.xxx:10077" , "ok" : 0.0 , "errmsg" : "unauthorized"}
This seems to be the sampler code which barfs with an error showing up as 500 in Visualiser
MongoScriptSampler.java
==========================
............
try {
MongoDB mon = MongoSourceElement.getMongoDB(getSource());
DB db = mon.getDB(getDatabase(), getUsername(), getPassword());
MongoScriptRunner runner = new MongoScriptRunner(db, getUsername(), getPassword());
res.latencyEnd();
res.setResponseData(runner.evaluate(db, data).getBytes());
}
....
I see that you use 2.7.2 . Did you use auth . From the code it seems it should work for you . I am not a MongoDB novice so dont have a clue .
I have been able to get it to run as a standalone chunk of code , so wonder whats wrong here
I have a few ideas on the lines of Monitoring AND Script development friendliness that can be added to MongoMeter .
Have a connect in the sampler which could pouplate a list of Columns .
Instead of just having a text have some basic validation JSON Validation I mean so that the sampler/script can be tested
Thank you a lot for you work in this area.
If you could go into your jmeter.properties file and set your log level for mongometer to debug, then try again.
Deletelog_level.jan=DEBUG
Then you can check the jmeter.log file. It will give more information on the issue.
Are you using the latest version of the mongometer.jar available on github (https://github.com/JanPaulEttles/mongometer/tree/master/out/artifacts)
What version of jmeter are you using?
#mongometer has been added to the core jmter project so you can download it straught from the jenkins server https://builds.apache.org/job/JMeter-trunk/lastSuccessfulBuild/artifact/trunk/dist/
I like the idea of a JSON validator, although I think you mean a JavaScript validator, or a MongoDB specific JS validator. Do you mean, you'd want to verify that the script that will be passed to the MongoDB eval function is sensibly formatted and validated?
does this plugin work windows jmeter. based on the readme provided some of the directory paths do not match Example /org/apache/jmeter/resources/messages.properties
ReplyDeleteThe path you refer to is within the jar file and not OS specific.
DeleteYou can find mongometer as part of the core product, so yes, it works on any OS jmeter runs on.
This comment has been removed by the author.
DeleteI've just downloaded the same build and everything is there as expected.
DeleteThe server address is the address where you server is running. If it's on the same machine you can add 127.0.0.1, if it is on a different machine on the network such as 192.168.06, then add that.
Hi,
ReplyDeleteWhen I try to run the script it shows the following error:
2013/05/27 10:42:56 INFO - jmeter.engine.StandardJMeterEngine: Running the test!
2013/05/27 10:42:56 DEBUG - jan.mongometer.config.MongoSourceElement: MongoDB Source Config testStarted
2013/05/27 10:42:56 ERROR - jmeter.JMeter: Uncaught exception: java.lang.NoClassDefFoundError: com/mongodb/MongoOptions
at jan.mongometer.config.MongoSourceElement.testStarted(MongoSourceElement.java:204)
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:212)
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:324)
at java.lang.Thread.run(Thread.java:722)
am I missing some configuration here?
This is not a mongometer specific error, it looks like you haven't added the mongodb jar to the classpath.
DeleteWhy not download the nightly build of jmeter, mongometer has been added as a plugin and you won't have to concern yourself with any 'config' issues
I tried this both with JMeter 2.8 and 2.9, using latest version of mongometer.
ReplyDeleteSee the comment above.
Deleteok thanks. using one of jmeter nightly builds worked fine.
ReplyDeletecould you please explain a bit more abt meaning of MongoDB Source. what does it mean exactly?
When I wanted to query a sharded collection, it is showing this error:
ReplyDelete{ "serverUsed" : "/xxxIP:27017" , "errmsg" : "exception: JavaScript execution failed: Error: can't use sharded collection from db.eval near '{return db.collectionName.find().count' " , "code" : 16722 , "ok" : 0.0}
http://docs.mongodb.org/manual/reference/limits/
Deletedb.eval() is incompatible with sharded collections. You may use db.eval() with un-sharded collections in a shard cluster.
I am not using db.eval() directly. i am simply sending this request via Mongo DB Script sampler function() {return db.collection.find().count();}
ReplyDeletedoes this mean this mongometer plugin does not support sending queries to sharded collection?
ReplyDeletethanks
The plugin uses db.eval() under the covers; it was the only was that I could pass in arbitrary scripts without having to implement a parser. The plugin was only ever written to compare scripts relative to each other, and shards weren't in my thoughts. So in short, no, the plugin was never intended to work with sharding.
DeleteIf you have any ideas on how db.eval() can be replaced, then I'm happy to look at it.
This comment has been removed by a blog administrator.
DeleteBest casinos for UK players to play slots - DRMCD
ReplyDeletePlay slots online 안성 출장마사지 for free 김천 출장마사지 at best casinos in the 전주 출장마사지 UK. Safe and 제주도 출장마사지 secure deposits & withdrawals. Find trusted UK casino sites.Are there UK online slots 전라남도 출장샵 to play with?