Solr HTTP要求のトレース

クエリーのためのトラブルシューティングのヒント:Solr HTTP要求のトレース。

クエリーのデバッグやトラブルシューティングを行う際には、以下のいずれかの方法でSolr HTTP要求をトレースすることができます。
  • 確率的トレーシングを有効にする。
  • 明示的なcassandra.trace=true要求パラメーターをHTTPクエリーに渡す。

Joinクエリーの使用例を実行した後で、cassandra.traceパラメーターをHTTP要求に追加して、Joinクエリーをトレースすることができます。

http://localhost:8983/solr/internet.songs/select/?q={!join+from=song+to=id+fromIndex=internet.lyrics+force=true}words:love&indent=true&wt=json&cassandra.trace=true

Solrの応答には、その要求のトレーシング・セッションの一意のセッションIDであるcassandra.trace.session値が含まれています。

{
"cassandra.trace.session":"3e503490-bdb9-11e3-860f-73ded3cb6170",
"responseHeader":{
"status":0,
"QTime":1,
"params":{
"indent":"true",
"q":"{!join from=song to=id fromIndex=internet.lyrics force=true}words:love",
"wt":"json",
"cassandra.trace":"true"}},
"response":{"numFound":2,"start":0,"docs":[
      {
"id":"8a172618-b121-4136-bb10-f665cfc469eb",
"title":"Internet Love Song",
"artist":"John Cedrick"},
      {
"id":"a3e64f8f-bd44-4f28-b8d9-6938726e34d4",
"title":"Dangerous",
"artist":"Big Data"}]
}}

トレースの情報を表示するには、system_traces.eventsのクエリーを実行し、セッションIDを使用して出力をフィルターします。

cqlsh> select * from system_traces.events where session_id = 3e503490-bdb9-11e3-860f-73ded3cb6170;

session_id  | activity                                                                  | source_elapsed  
-------------+---------------------------------------------------------------------------+----------------
3e503490...|          Parsing SELECT * from "internet"."songs" WHERE "id" = 8a172618...|           2607 
3e503490...|                                                       Preparing statement |           3943 
3e503490...|                                 Executing single-partition query on songs |           4246 
3e503490...|                                              Acquiring sstable references |           4261 
3e503490...|                                               Merging memtable tombstones |           4305 
3e503490...|                                               Key cache hit for sstable 1 |           4388 
3e503490...|                         Seeking to partition indexed section in data file |           4399 
3e503490...| Skipped 0/1 non-slice-intersecting sstables, included 0 due to tombstones |           4873 
3e503490...|                                Merging data from memtables and 1 sstables |           4954 
3e503490...|                                        Read 1 live and 0 tombstoned cells |           5162 
3e503490...|        Parsing SELECT * from "internet"."songs" WHERE "id" = a3e64f8f...  |           6160 
3e503490...|                                                       Preparing statement |           7424
 . . .

event_id、ノードIPアドレス、スレッドIDは、例示の関係上、ページ内に収めるためにこの出力から除外されています。

複数のノードにおける分散クエリーの場合、Cassandraはすべてのノードで同じトレーシング・セッションIDを使用します。このため、分散クエリーに参加しているすべてのノードでCassandraの操作を相互に対応付けることが可能になります。