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
schema.xml 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
solrmeter.smc.xml) 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 GitHub issue. 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
headless.outputDirectory 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.