Apache Solr Apache Zookeeper Learning To Rank Tips And Tricks

As seen in the previous blog post about Apache Solr Learning to Rank Feature and Model Stores, there are many operations we can do with feature stores and model stores in Apache Solr.

On this page, I would like to focus on the main errors that can arise in using those methods and of which we have to be aware.

Reload

The first thing that could happen is that we upload our feature store or model but we don’t see the new components in the corresponding feature-store or model-store.

Every change made on these two stores need the collection to be reloaded in order to see the results, therefore:

After uploading the feature store to the feature-store, it is important to reload the collection in order to successfully apply the changes.
After uploading the model to the model-store, it is important to reload the collection in order to successfully apply the changes.

The same for the deletion of a feature store or model:

After deleting the desired feature store, it is important to reload the collection in order to successfully apply the changes.
After deleting the desired model, it is important to reload the collection in order to successfully apply the changes.

How to reload the collection :

http://localhost:8983/solr/admin/collections?action=RELOAD&name=newCollection

Error on model upload

A possible error that could arise during the upload of an Apache Solr model is:

org.apache.solr.ltr.model.ModelException: Model type does not exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel

This is due to the fact that we are uploading a model that uses a wrong or inexistent feature store.

To make an example.

Suppose we have this feature-store:

{
  "responseHeader": {
       "status": 0,
       "QTime": 160
  },
  "featureStores": [
      "first_store",
      "second_store"
  ]
}

And suppose we are uploading this model:

{
    "store": "third_store",
    "name": "first_model",
    "class": "org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
    "features": [
        {
            "name": "feature_1"
        },
        {
            "name": "feature_2"
        },
        {
            "name": "feature_3"
        },
....

This process will raise an exception since the “store” field of the model doesn’t match with any store name in the feature-store.

In this case, we need to load the feature store first and then the model.
Be sure that the “store” field in the model matches the correct store “name” in the feature-store.

Error in feature deletion

We have to be careful also when deleting a feature store.

If we delete a used feature store, at the moment of the collection reload we will obtain this error:

org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Failed to create new ManagedResource /schema/model-store of type org.apache.solr.ltr.store.rest.ManagedModelStore due to: org.apache.solr.common.SolrException: org.apache.solr.ltr.model.ModelException: Model type does not exist org.apache.solr.ltr.model.MultipleAdditiveTreesModelorg.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://10.0.0.23:8983/solr: Unable to reload core [adore_solr_shard1_replica_n1]org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Failed to create new ManagedResource /schema/model-store of type org.apache.solr.ltr.store.rest.ManagedModelStore due to: org.apache.solr.common.SolrException: org.apache.solr.ltr.model.ModelException: Model type does not exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel

And in the Solr User Interface we will find this banner on the top of the page:

org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Failed to create new ManagedResource /schema/model-store of type org.apache.solr.ltr.store.rest.ManagedModelStore due to: org.apache.solr.common.SolrException: org.apache.solr.ltr.model.ModelException: Model type does not exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel

This is because now the model that was using the deleted feature store doesn’t find its reference to the store.

It is always best to remove the model first and then, if necessary, the corresponding feature store.
A feature store can be deleted only when there are no models using it.

Pay attention to Apache ZooKeeper

Another issue that could arise is related to ZooKeeper file limit.
From the documentation:

https://lucene.apache.org/solr/guide/8_8/setting-up-an-external-zookeeper-ensemble.html#increasing-the-file-size-limit

It could indeed happen that you can’t see the feature store or model you uploaded even after the reload of the collection.

We can see that the default file size limit that ZooKeeper can manage is 1MB. This may be too small when loading your learning to rank model and therefore can lead to upload problems. If the file can’t be uploaded due to its size, we will not be able to see it in the feature-store/model-store.

Check the dimension of the feature/model file you want to upload to Solr.
If necessary increase the ZooKeeper file size limit.

JVM Heap Memory Usage

Another thing to keep under control is the JVM Heap Memory usage.
The required memory for feature stores and models management could be high and we can saturate the available one like.

In this image we can see an example of this behavior. At 9:12 we saturate the memory till the 9:18.

Check the JVM heap memory usage during stores and models management.
If necessary increase the memory size.

Great news!

Thanks to Alessandro Benedetti‘s contribution, the errors that can arise with model upload and feature deletion are going to be much more readable and clear in the next Solr 8.9 version!
You can see the new changes in the Jira issue: https://issues.apache.org/jira/browse/SOLR-15149

Did you like this post about Common Errors with Apache Solr Feature and Model Stores? Don’t forget to subscribe to our Newsletter to stay always updated!

Processing…
Success! You're on the list.

Author

Anna Ruggero

Anna Ruggero is a software engineer passionate about Information Retrieval and Data Mining. She loves to find new solutions to problems, suggesting and testing new ideas, especially those that concern the integration of machine learning techniques into information retrieval systems.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: