Keep track of Solr performance

janusman - March 21, 2009 - 00:41
Project:Apache Solr Search Integration
Version:6.x-2.x-dev
Component:Miscellaneous
Category:task
Priority:minor
Assigned:Unassigned
Status:closed
Description

Just thought it'd be awesome to have a sparkline graph (Google Charts?) that displays performance; both indexing and search. =) Also might be helpful to know if/when searches are taking "too" long.

#1

janusman - June 22, 2009 - 22:54
Title:Admin candy: sparkline graph showing Solr performance» Keep track of Solr performance

Toning this down: it would at *least* be helpful to know long query, MLT, indexing (and other?) operations are taking. Any pointers to existing projects like this one?

#2

Scott Reynolds - June 22, 2009 - 23:12

apphend to the query queryDebug=true and you get a whole lot of useful stuffs

http://wiki.apache.org/solr/CommonQueryParameters#head-f45a9396425956a4d...

Be cool to log some of that away, and only when enabled

edit: i don't believe it works with mlt though :(

#3

robertDouglass - July 17, 2009 - 10:42
Version:6.x-1.x-dev» 6.x-2.x-dev

A debug mode would be interesting.

#4

janusman - July 24, 2009 - 21:38
Status:active» needs review

First proposed patch; this is a contrib module that leverages Apache Solr's hooks to add debugging info. to each query and log query results on query completion.

Instructions:
* Patch applies to 6.x-1.x and 2.x, as does not modify existing files, just adds a new module in contrib/
* Enable the module "Apache Solr Statistics" under admin/build/modules under
* Go to admin/settings/apachesolr/stats and enable logging.
* Do some searches, and go to admin/reports/apachesolr/stats to see the report (see attached sample).

It's still missing quite a lot:
* Want to register clickthrus to report which facets were most valuable to obtain those... this way I'd know a little about what my users are using (and ignoring).
* Want to register clickthrus for the spellchecker suggestions.
* Want to report indexing performance.

AttachmentSize
408990-4 sample report.jpg 84.81 KB
apachesolr-408990-4.patch 15.03 KB

#5

janusman - July 24, 2009 - 21:52

In case someone wants just the contrib/apachesolr_stats folder, here is a ZIP file you can place in your modules/apachesolr/contrib folder (although it'll work fine in sites/all/modules)...

AttachmentSize
apachesolr_stats.zip 6.39 KB

#6

janusman - July 29, 2009 - 14:11
Status:needs review» needs work

Just a note, the graphs' granularity is "per minute", which will surely break when the log begins to fill up. Will issue a new version soon.

#7

janusman - July 29, 2009 - 14:17
Status:needs work» needs review

New patch and .zip file.

Changes: This now uses the shorter data format from Google Charts, so that more points can fit in a single image. It also now aggregates results per hour, not by minute.

AttachmentSize
apachesolr_stats-7.zip 6.79 KB
apachesolr-408990-7.patch 17.08 KB

#8

robertDouglass - August 13, 2009 - 13:28

<?php
 
if (! variable_get('apachesolr_stats_enabled', 0)) {
    return
t('Logging is disabled in the !link. Enable it to log Apache Solr queries.', array('!link' => l('module configuration page', 'admin/settings/apachesolr/stats')));
  }
?>

could that be part of the access checking for the report path in hook_menu so you never get to the report if logging isn't enabled?

#9

robertDouglass - August 13, 2009 - 13:30

with regards to granularity: Something like a set of links to change granularity on the reports page would be great: month | day | hour | minute

And then somehow change this:
$result = db_query_range("SELECT * FROM {apachesolr_stats} ORDER BY timestamp DESC", 0, 1000);

Except... result sets will get really really big. Hmmm.

#10

robertDouglass - August 13, 2009 - 13:34

I know we all trust google... but can we do something to protect this from abusive input?

<?php
  $image_url
= $chart_prefix . $encoded_values; #&chdl=". t('Queries per minute');
  // Add labels
 
$image_url .= "&chxl=0:|". intval($chd_min) ."|". intval($chd_max);
  if (
$average !== FALSE) {
   
$image_url .=sprintf("|1:|%s=%.2f", t('average'), $average);
   
$image_url .= "&chxp=1," . intval($average/$chd_max*100);
   
$chxt = "y,r";
  } else {
   
$chxt = "y";
  }
 
$image_url .= "&chxt=$chxt";
  return
"<img src='$image_url'>";
}
?>

Peter - do you see any risk here?

#11

robertDouglass - August 13, 2009 - 13:35

Awesome functionality! I think the trend is to make separate projects instead of adding to /contrib. I think you should just make a new project and commit it =)

#12

janusman - August 14, 2009 - 00:01
Status:needs review» closed

Thanks for your review and help... opened up a new project:

http://drupal.org/project/apachesolr_stats

Closing this out. =)

 
 

Drupal is a registered trademark of Dries Buytaert.