Running SolrMeter Without a UI
With headless mode, you can run SolrMeter in a scenario where you don't have a UI. You can automate the test with a script because you don't need to interact with a UI.
Join the DZone community and get the full member experience.Join For Free
solrmeter is a nice java program that allows you to test the performance of your solr installation under heavy load. this tool is not capable of handling very high loads with the coordination of multiple clients, nor it can test installation with multiple solr machines in a round robin way to distribute queries across all machines. however, it does really decent work in helping you have some raw numbers about how your solr installation performs.
solrmeter can really help you to understand how solr performs, especially if you need to compare different
solutions or different hardware or core configurations.
using the tool is straightforward; follow the tutorial here . just compile the latest version of maven; then, it is just a matter of creating some files containing the queries you want to issue (param q=), filter queries that you want to use (param fq=), and finally, a series of fields used for faceting.
in the settings menu, you can simply configure everything you need. the first tab allows you to specify all files that contain data to generate the query, as well as the address of the core/collection you want to test.
figure 1:a typical solrmeter configuration.
now, you can just specify how many queries per second you want to issue to your server, then press the play button, and the test starts.
figure 2: choose queries per second and then run the test.
what type of data you can grab from solrmeter
the tool gives you lots of information and graphs that can help you understand how well your solr installation performswith the set of queries you are issuing to the server. in a typical graph, you can look at the distribution of the average response times of the query during the run.
figure 3: query history.
in figure 3, i can see that the average query time for the first 10 seconds is about 375 ms, while for subsequent queries, the average response time is under 50 ms. another interesting graph is the distribution of query execution time during the load.
figure 4: average response time for queries.
in the x-axis, you have execution time. in the y-axis, you have the number of queries. from the figure 4graph, you can verify that most of the queries were executed under 500ms, with high peaks of some queries that needed 12 seconds to be executed.
running without a ui
there are other cool features about solrmeter, but i want to show you a feature that is less known and that is really useful: the ability to run without a ui. once you’ve setup a test load with ui, you can choose file/export to export the actual solrmeter configuration to a file.
exporting configurations to a file generates a nice xml file with all the options configured with the ui.
once you have exported the configuration file, you can copy it along with a solrmeter jar file and all the various configuration files (the ones with queries, filters, etc.) to your target server with ssh (solr is usually installed on a linux machine without ui).
once all the files are copied, it is really simple to edit the main xml configuration files if you need to change something. you can update the address of the core to test, the location of the various configuration files, etc.
running solrmeter in the same machine that is running solr is not usually a good idea, but there are scenarios in which running without a ui is the only way to go. as an example, consider an installation where you have your solr machines and a web application server installed on linux without a ui and in an isolated environment where you can access only with ssh. in this scenario, to run a load test, you should run the test from the web application machine to really simulate a real scenario from the web application machine to the solr machine.
in many scenarios, you need to run your load test from the machine that is accessing solr, and it has no ui.
now, you need to create an xml file (usually named
) that contains all solrmeter configurations for the run. here is some possible content:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <!doctype properties system "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>solr meter configuration file. generated at 15-gen-2016</comment> <entry key="solr.query.querymode">standard</entry> <entry key="headless.performqueryoperations">true</entry> <entry key="solr.update.documentstocommit">100</entry> <entry key="executor.optimizeexecutor">ondemand</entry> <entry key="solr.server.configuration.httpauthuser"/> <entry key="statistic.refreshtime">2000</entry> <entry key="solr.querymethod">get</entry> <entry key="guice.headlessmodule">com.plugtree.solrmeter.headlessmodule</entry> <entry key="statistic.configuration.filepath">statistics-config.xml</entry> <entry key="headless.numupdates">100</entry> <entry key="solr.query.usefacets">true</entry> <entry key="solr.query.usefilterqueries">true</entry> <entry key="solr.server.configuration.followredirect">false</entry> <entry key="solr.query.addrandomextraparams">true</entry> <entry key="solr.queriesfiles">c:\develop\xxxxxx\solrmeter\test1\set1_queries.txt</entry> <entry key="solrconnectedbutton.pinginterval">5000</entry> <entry key="statistic.timerange.range501_1000">true</entry> <entry key="solr.query.filterqueriesfile">c:\develop\xxxxxx\tools\solrmeter\test1\set1_filterqueries.txt</entry> <entry key="guice.solrmeterrunmodemodule">com.plugtree.solrmeter.solrmeterrunmodemodule</entry> <entry key="solr.update.timetocommit">10000</entry> <entry key="guice.standalonepresentationmodule">com.plugtree.solrmeter.standalonepresentationmodule</entry> <entry key="statistic.timerange.range0_500">true</entry> <entry key="solr.documentidfield">id</entry> <entry key="solr.update.solrautocommit">false</entry> <entry key="solr.documentfieldsfile">c:\develop\xxxxxx\tools\solrmeter\test1\set1_fields.txt</entry> <entry key="solr.testtime">1</entry> <entry key="files.charset">utf-8</entry> <entry key="statistic.timerange.range1001_2000">true</entry> <entry key="solr.server.configuration.allowcompression">true</entry> <entry key="solr.server.configuration.sotimeout">60000</entry> <entry key="headless.outputdirectory">./solrmeter-headless</entry> <entry key="statistic.showingstatistics">all</entry> <entry key="solr.query.echoparams">false</entry> <entry key="solr.query.extraparameters">indent=true,debugquery=false</entry> <entry key="executor.queryexecutor">random</entry> <entry key="solr.searchurl">http://localhost:8983/solr/mycore</entry> <entry key="guice.modelmodule">com.plugtree.solrmeter.modelmodule</entry> <entry key="solr.query.extraparams">c:\develop\xxxxxx\tools\solrmeter\test1\set1_extraparams.txt</entry> <entry key="solr.server.configuration.maxtotalconnections">1000000</entry> <entry key="statistic.timerange.range2001_2147483647">true</entry> <entry key="solr.errorlogstatistic.maxstored">400</entry> <entry key="guice.statisticsmodule">com.plugtree.solrmeter.statisticsmodule</entry> <entry key="executor.updateexecutor">random</entry> <entry key="solr.updatesfiles"/> <entry key="headless.performupdateoperations">false</entry> <entry key="headless.numqueries">100</entry> <entry key="solr.load.queriespersecond">5</entry> <entry key="solr.search.querytype"/> <entry key="solr.server.configuration.maxretries">1</entry> <entry key="solr.addurl">http://localhost:8983/solr/techproducts</entry> <entry key="solr.load.updatespersecond">1</entry> <entry key="solr.server.configuration.defaultmaxconnectionsperhost">100000</entry> <entry key="solr.querylogstatistic.maxstored">1000</entry> <entry key="solr.query.facetmethod">fc</entry> <entry key="solr.server.configuration.connectiontimeout">60000</entry> </properties>
as you can see, you have various options to configure, and all of them are really self-explanatory. if you are interested, lots of the options are explained in this
. the most important options are the address of the core and the path of the files that contain queries. now, you only need to run solrmeter in headless mode with the following command line (note the
java -dsolrmeter.runmode=headless -dsolrmeter.configurationfile=solrmeter.smc.xml -jar solrmeter-0.3.1-snapshot-jar-with-dependencies.jar
then, wait for the test to finish, and you will find all the output in the folder you specify with the
settings. now, you only need to grab the result, put it in an excel spreadsheet, and do whatever you want with the data.
thanks to headless mode, you can run solrmeter even in a scenario where you don't have a ui. most importantly, you can automate the test with a script because you don't need to interact with a ui.
Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.