You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Florin Babes <ba...@gmail.com> on 2023/10/15 06:54:05 UTC

Zk big files issues and model store

Hello,
We reached the limit of zk for storing LTR models. I want to avoid the
usage of DefaultWrapperModel for as long as possible because we have
deployed in an container orchestrator and this implementation can be
really risky if you can not guarantee the presence of the model on
disk all the time.
So I want to use the managed model feature to upload some bigger
models but zk is dying with OOM. What we noticed is that solr stores
the models in a json indented file. By saving the models in compacted
json our models will be 60% smaller.
Do you think that we should try to implement this? Could this work and
allow us to postpone the moment of using DefaultWrapperModel?
Thanks,
Florin Babes

Re: Zk big files issues and model store

Posted by Florin Babes <ba...@gmail.com>.
Hello,

I've created an issue and a PR (
https://issues.apache.org/jira/browse/SOLR-17050)
The models will also be smaller because they will be saved without newlines
and without spaces after keys:

> ~ cat d.txt
> "x":{"y":{"z":{"foobar":42}}}
> ~ wc -c d.txt
>       30 d.txt


For example the following model:

> ~ cat modelExamples/linear-model.json
> {
>   "class": "org.apache.solr.ltr.model.LinearModel",
>   "name": "6029760550880411648",
>   "features": [
>     {
>       "name": "title"
>     },
>     {
>       "name": "description"
>     },
>     {
>       "name": "keywords"
>     },
>     {
>       "name": "popularity",
>       "norm": {
>         "class": "org.apache.solr.ltr.norm.MinMaxNormalizer",
>         "params": {
>           "min": "0.0f",
>           "max": "10.0f"
>         }
>       }
>     },
>     {
>       "name": "text"
>     },
>     {
>       "name": "queryIntentPerson"
>     },
>     {
>       "name": "queryIntentCompany"
>     }
>   ],
>   "params": {
>     "weights": {
>       "title": 0.0000000000,
>       "description": 0.1000000000,
>       "keywords": 0.2000000000,
>       "popularity": 0.3000000000,
>       "text": 0.4000000000,
>       "queryIntentPerson": 0.1231231,
>       "queryIntentCompany": 0.12121211
>     }
>   }
> }
> ~ curl -XPUT 'http://localhost:8983/solr/small_models/schema/model-store'
> --data-binary "@modelExamples/linear-model.json" -H
> 'Content-type:application/json'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":23
>   }
> }

will be saved as

> curl
> http://localhost:8983/solr/small_models/admin/file\?wt\=json\&_\=1697901271281\&file\=_schema_model-store.json\&contentType\=application%2Fjson%3Bcharset%3Dutf-8
>
> {"initArgs":{},"initializedOn":"2023-10-21T15:13:08.571Z","managedList":[{"name":"6029760550880411648","class":"org.apache.solr.ltr.model.LinearModel","store":"_DEFAULT_","features":[{"name":"title","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"description","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"keywords","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"popularity","norm":{"class":"org.apache.solr.ltr.norm.MinMaxNormalizer","params":{"min":"0.0","max":"10.0"}}},{"name":"text","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"queryIntentPerson","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"queryIntentCompany","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}}],"params":{"weights":{"title":0.0,"description":0.1,"keywords":0.2,"popularity":0.3,"text":0.4,"queryIntentPerson":0.1231231,"queryIntentCompany":0.12121211}}}]}


which is* 42%* smaller than compacted




~ echo
> '{"initArgs":{},"initializedOn":"2023-10-21T15:13:08.571Z","managedList":[{"name":"6029760550880411648","class":"org.apache.solr.ltr.model.LinearModel","store":"_DEFAULT_","features":[{"name":"title","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"description","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"keywords","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"popularity","norm":{"class":"org.apache.solr.ltr.norm.MinMaxNormalizer","params":{"min":"0.0","max":"10.0"}}},{"name":"text","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"queryIntentPerson","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"queryIntentCompany","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}}],"params":{"weights":{"title":0.0,"description":0.1,"keywords":0.2,"popularity":0.3,"text":0.4,"queryIntentPerson":0.1231231,"queryIntentCompany":0.12121211}}}]}'
> | jq | wc -c
>     *1688*

~ echo
> '{"initArgs":{},"initializedOn":"2023-10-21T15:13:08.571Z","managedList":[{"name":"6029760550880411648","class":"org.apache.solr.ltr.model.LinearModel","store":"_DEFAULT_","features":[{"name":"title","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"description","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"keywords","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"popularity","norm":{"class":"org.apache.solr.ltr.norm.MinMaxNormalizer","params":{"min":"0.0","max":"10.0"}}},{"name":"text","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"queryIntentPerson","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},{"name":"queryIntentCompany","norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}}],"params":{"weights":{"title":0.0,"description":0.1,"keywords":0.2,"popularity":0.3,"text":0.4,"queryIntentPerson":0.1231231,"queryIntentCompany":0.12121211}}}]}'
> | wc -c
>      *977*


Multumesc,

Florin Babeş
0762680124
babesflorin@gmail.com


În joi, 19 oct. 2023 la 16:27, Christine Poerschke (BLOOMBERG/ LONDON) <
cpoerschke@bloomberg.net> a scris:

> Hello Florin.
>
> Of course, do feel free to open an issue and/or draft pull request and/or
> pull request.
>
> If the model is wrapped internally, it would be smaller than the original
> (since no two-space indentations) but slightly bigger than the compacted
> (with zero-space indentations) due to \" escaping for " characters.
>
> Illustration:
>
> $cat a.txt
> "x" : {
>   "y" : {
>     "z" : {
>       "foobar" : 42
>     }
>   }
> }
> $wc -c a.txt
>       62 a.txt
>
> $cat b.txt
> "x" : {
> "y" : {
> "z" : {
> "foobar" : 42
> }
> }
> }
> $wc -c b.txt
>       44 b.txt
>
> $cat c.txt
> \"x\" : { \"y\" : { \"z\" : { \"foobar\" : 42 } } }
> $wc -c c.txt
>       52 c.txt
> $
>
> From: users@solr.apache.org At: 10/18/23 20:40:24 UTC+1:00To:
> users@solr.apache.org
> Subject: Re: Zk big files issues and model store
>
> Thanks for the suggestion Matthias. I will look into this.
>
> Hello Christine. One of the concerns is the split nature but also that
> if the file does not exist on disk when the replica reloads, the core
> would not load. To keep the models in sync on each node can be quite
> complicated. For example you will only have to reload the collection
> only after the main model is present on all nodes, if you do it before
> that the replicas will be unusable. For now we would like to load
> models up to 100MB and that's why I explored this option.
> I did some modifications in the code but I haven't tested them yet.
> After I do the tests, I will come with a PR. Can I open an issue with
> this?
>
> If the model would be wrapped internal, wouldn't that be the same as
> saving it as compacted json? It will be the approximately same size
> and we will still need to load in memory the decoded object. To save
> size we could reduce the features size to some abbreviations but that
> will complicate the score debug.
> Haven't looked yet in storing models in another format. Walter could
> have a point in AVRO.
>
> Thanks for the suggestion Eric. I am not familiar with the
> /api/cluster/files endpoint. I will look into it.
>
>
> În mie., 18 oct. 2023 la 01:47, Dmitri Maziuk <dm...@gmail.com> a
> scris:
> >
> > On 10/17/23 13:20, Walter Underwood wrote:
> > >
> > > Gzipping the JSON can be a big win, especially if there are lots of
> repeated keys, like in state.json. Gzip has the advantage that some
> editors can
> natively unpack it.
> >
> > It may save you some transfer time, provided the transport subsystem
> > doesn't compress on the fly, but with JSON being all-or-nothing format,
> > your problem's going to be RAM for the string representation plus RAM
> > for the decoded object representation, of the entire store.
> >
> > If you want it scalable, you want an "incremental" format like asn.1,
> > protocol buffers, or avro.
> >
> > Dima
> >
>
>
>

Re: Zk big files issues and model store

Posted by "Christine Poerschke (BLOOMBERG/ LONDON)" <cp...@bloomberg.net>.
Hello Florin.

Of course, do feel free to open an issue and/or draft pull request and/or pull request.

If the model is wrapped internally, it would be smaller than the original (since no two-space indentations) but slightly bigger than the compacted (with zero-space indentations) due to \" escaping for " characters.

Illustration:

$cat a.txt
"x" : {
  "y" : {
    "z" : {
      "foobar" : 42
    }
  }
}
$wc -c a.txt
      62 a.txt

$cat b.txt
"x" : {
"y" : {
"z" : {
"foobar" : 42
}
}
}
$wc -c b.txt
      44 b.txt

$cat c.txt
\"x\" : { \"y\" : { \"z\" : { \"foobar\" : 42 } } }
$wc -c c.txt
      52 c.txt
$

From: users@solr.apache.org At: 10/18/23 20:40:24 UTC+1:00To:  users@solr.apache.org
Subject: Re: Zk big files issues and model store

Thanks for the suggestion Matthias. I will look into this.

Hello Christine. One of the concerns is the split nature but also that
if the file does not exist on disk when the replica reloads, the core
would not load. To keep the models in sync on each node can be quite
complicated. For example you will only have to reload the collection
only after the main model is present on all nodes, if you do it before
that the replicas will be unusable. For now we would like to load
models up to 100MB and that's why I explored this option.
I did some modifications in the code but I haven't tested them yet.
After I do the tests, I will come with a PR. Can I open an issue with
this?

If the model would be wrapped internal, wouldn't that be the same as
saving it as compacted json? It will be the approximately same size
and we will still need to load in memory the decoded object. To save
size we could reduce the features size to some abbreviations but that
will complicate the score debug.
Haven't looked yet in storing models in another format. Walter could
have a point in AVRO.

Thanks for the suggestion Eric. I am not familiar with the
/api/cluster/files endpoint. I will look into it.


În mie., 18 oct. 2023 la 01:47, Dmitri Maziuk <dm...@gmail.com> a scris:
>
> On 10/17/23 13:20, Walter Underwood wrote:
> >
> > Gzipping the JSON can be a big win, especially if there are lots of 
repeated keys, like in state.json. Gzip has the advantage that some editors can 
natively unpack it.
>
> It may save you some transfer time, provided the transport subsystem
> doesn't compress on the fly, but with JSON being all-or-nothing format,
> your problem's going to be RAM for the string representation plus RAM
> for the decoded object representation, of the entire store.
>
> If you want it scalable, you want an "incremental" format like asn.1,
> protocol buffers, or avro.
>
> Dima
>



Re: Zk big files issues and model store

Posted by Florin Babes <ba...@gmail.com>.
Thanks for the suggestion Matthias. I will look into this.

Hello Christine. One of the concerns is the split nature but also that
if the file does not exist on disk when the replica reloads, the core
would not load. To keep the models in sync on each node can be quite
complicated. For example you will only have to reload the collection
only after the main model is present on all nodes, if you do it before
that the replicas will be unusable. For now we would like to load
models up to 100MB and that's why I explored this option.
I did some modifications in the code but I haven't tested them yet.
After I do the tests, I will come with a PR. Can I open an issue with
this?

If the model would be wrapped internal, wouldn't that be the same as
saving it as compacted json? It will be the approximately same size
and we will still need to load in memory the decoded object. To save
size we could reduce the features size to some abbreviations but that
will complicate the score debug.
Haven't looked yet in storing models in another format. Walter could
have a point in AVRO.

Thanks for the suggestion Eric. I am not familiar with the
/api/cluster/files endpoint. I will look into it.



În mie., 18 oct. 2023 la 01:47, Dmitri Maziuk <dm...@gmail.com> a scris:
>
> On 10/17/23 13:20, Walter Underwood wrote:
> >
> > Gzipping the JSON can be a big win, especially if there are lots of repeated keys, like in state.json. Gzip has the advantage that some editors can natively unpack it.
>
> It may save you some transfer time, provided the transport subsystem
> doesn't compress on the fly, but with JSON being all-or-nothing format,
> your problem's going to be RAM for the string representation plus RAM
> for the decoded object representation, of the entire store.
>
> If you want it scalable, you want an "incremental" format like asn.1,
> protocol buffers, or avro.
>
> Dima
>

Re: Zk big files issues and model store

Posted by Dmitri Maziuk <dm...@gmail.com>.
On 10/17/23 13:20, Walter Underwood wrote:
> 
> Gzipping the JSON can be a big win, especially if there are lots of repeated keys, like in state.json. Gzip has the advantage that some editors can natively unpack it.

It may save you some transfer time, provided the transport subsystem 
doesn't compress on the fly, but with JSON being all-or-nothing format, 
your problem's going to be RAM for the string representation plus RAM 
for the decoded object representation, of the entire store.

If you want it scalable, you want an "incremental" format like asn.1, 
protocol buffers, or avro.

Dima


Re: Zk big files issues and model store

Posted by Walter Underwood <wu...@wunderwood.org>.
Apache Avro is a JSON-equivalent binary format. That would be smaller. Looking around the web, it might be 2X to 4X smaller.

Gzipping the JSON can be a big win, especially if there are lots of repeated keys, like in state.json. Gzip has the advantage that some editors can natively unpack it.

This page has some size comparisons for one data set.

https://www.adaltas.com/en/2021/03/22/performance-comparison-of-file-formats/

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)

> On Oct 17, 2023, at 11:09 AM, Christine Poerschke (BLOOMBERG/ LONDON/ V) <cp...@bloomberg.net> wrote:
> 
> Hi Florin and Matthias,
> 
> Thanks for sharing about this!
> 
> Looking into where the JSON indentation in storage comes from -- from code reading only -- I think this is the code trail:
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/modules/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedModelStore.java#L46
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResource.java#L348
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResource.java#L238
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java#L443
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/solrj/src/java/org/apache/solr/common/util/Utils.java#L218-L227
> 
> Thinking out aloud ...
> 
> ... how might storing the model in non-JSON format work? Haven't looked into.
> 
> ... what are the concerns about DefaultWrapperModel usage, I'm guessing it's the split nature (i.e. the wrapper part of the model in ZK but the resource part on disk) -- is that so?
> 
> Looking at the https://solr.apache.org/docs/9_4_0/modules/ltr/org/apache/solr/ltr/model/DefaultWrapperModel.html javadocs for an example configuration and there noticing the
> 
>  "resource": "models/myModel.json"
> 
> element made me wonder ...
> 
> ... what if the resource being wrapped was not external (giving rise to the split nature scenario) but internal inlined in the model?
> 
> ... Yes, something like
> 
>  "content": "{ \"class\": \"org.apache.solr.ltr.model.LinearModel\", \"name\": \"myModelName\", \"params\": { ... } }"
> 
> would be a bit human-unreadable but would it save enough space?
> 
> And/Or could representation in non-JSON format be of interest in some use cases?
> 
>  "format": "foobar",
>  "content": " ... model representation in foobar format goes here ... "
> 
> https://github.com/apache/solr/pull/2018 explores the AlternativeFormatWrapperModel idea.
> 
> Hope that helps.
> 
> Best wishes,
> Christine
> 
> From: users@solr.apache.org At: 10/16/23 15:02:23 UTC+1:00To:  users@solr.apache.org
> Subject: Re: Zk big files issues and model store
> 
> Hi Florin,
> 
> What has worked for me was making model deployment a software deployment
> task and bundling the model
> in the JAR I deployed with Solr as the DefaultWrapperModel also loads
> resources from the classpath.
> 
> Cheers
> Matthias
> 
> 
> On Sun, Oct 15, 2023 at 8:54 AM Florin Babes <ba...@gmail.com> wrote:
> 
>> Hello,
>> We reached the limit of zk for storing LTR models. I want to avoid the
>> usage of DefaultWrapperModel for as long as possible because we have
>> deployed in an container orchestrator and this implementation can be
>> really risky if you can not guarantee the presence of the model on
>> disk all the time.
>> So I want to use the managed model feature to upload some bigger
>> models but zk is dying with OOM. What we noticed is that solr stores
>> the models in a json indented file. By saving the models in compacted
>> json our models will be 60% smaller.
>> Do you think that we should try to implement this? Could this work and
>> allow us to postpone the moment of using DefaultWrapperModel?
>> Thanks,
>> Florin Babes
>> 
> 
> 


Re: Zk big files issues and model store

Posted by Eric Pugh <ep...@opensourceconnections.com>.
One more idea….  As part of my investigation of using OpenNLP with Solr, I needed to deal with a 600 MB ONNX model.  I found out that I could POST the model file to the /api/cluster/files end point, and that it would be replicated around the cluster under the covers (though I confess to not stress testing that capability at all!).

I wonder if this is a potential route?  

Here is a link to an example:

https://github.com/apache/solr/pull/1999/files#diff-47fc3843c9e48d037036e8dc429abba113d546729099b03ecb6e2017961fc174R84
SOLR-17023: Use Modern NLP Models from Apache OpenNLP with Solr by epugh · Pull Request #1999 · apache/solr
github.com




> On Oct 17, 2023, at 2:09 PM, Christine Poerschke (BLOOMBERG/ LONDON/ V) <cp...@bloomberg.net> wrote:
> 
> Hi Florin and Matthias,
> 
> Thanks for sharing about this!
> 
> Looking into where the JSON indentation in storage comes from -- from code reading only -- I think this is the code trail:
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/modules/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedModelStore.java#L46
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResource.java#L348
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResource.java#L238
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java#L443
> * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/solrj/src/java/org/apache/solr/common/util/Utils.java#L218-L227
> 
> Thinking out aloud ...
> 
> ... how might storing the model in non-JSON format work? Haven't looked into.
> 
> ... what are the concerns about DefaultWrapperModel usage, I'm guessing it's the split nature (i.e. the wrapper part of the model in ZK but the resource part on disk) -- is that so?
> 
> Looking at the https://solr.apache.org/docs/9_4_0/modules/ltr/org/apache/solr/ltr/model/DefaultWrapperModel.html javadocs for an example configuration and there noticing the
> 
>  "resource": "models/myModel.json"
> 
> element made me wonder ...
> 
> ... what if the resource being wrapped was not external (giving rise to the split nature scenario) but internal inlined in the model?
> 
> ... Yes, something like
> 
>  "content": "{ \"class\": \"org.apache.solr.ltr.model.LinearModel\", \"name\": \"myModelName\", \"params\": { ... } }"
> 
> would be a bit human-unreadable but would it save enough space?
> 
> And/Or could representation in non-JSON format be of interest in some use cases?
> 
>  "format": "foobar",
>  "content": " ... model representation in foobar format goes here ... "
> 
> https://github.com/apache/solr/pull/2018 explores the AlternativeFormatWrapperModel idea.
> 
> Hope that helps.
> 
> Best wishes,
> Christine
> 
> From: users@solr.apache.org At: 10/16/23 15:02:23 UTC+1:00To:  users@solr.apache.org
> Subject: Re: Zk big files issues and model store
> 
> Hi Florin,
> 
> What has worked for me was making model deployment a software deployment
> task and bundling the model
> in the JAR I deployed with Solr as the DefaultWrapperModel also loads
> resources from the classpath.
> 
> Cheers
> Matthias
> 
> 
> On Sun, Oct 15, 2023 at 8:54 AM Florin Babes <ba...@gmail.com> wrote:
> 
>> Hello,
>> We reached the limit of zk for storing LTR models. I want to avoid the
>> usage of DefaultWrapperModel for as long as possible because we have
>> deployed in an container orchestrator and this implementation can be
>> really risky if you can not guarantee the presence of the model on
>> disk all the time.
>> So I want to use the managed model feature to upload some bigger
>> models but zk is dying with OOM. What we noticed is that solr stores
>> the models in a json indented file. By saving the models in compacted
>> json our models will be 60% smaller.
>> Do you think that we should try to implement this? Could this work and
>> allow us to postpone the moment of using DefaultWrapperModel?
>> Thanks,
>> Florin Babes
>> 
> 
> 

_______________________
Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 | http://www.opensourceconnections.com <http://www.opensourceconnections.com/> | My Free/Busy <http://tinyurl.com/eric-cal>  
Co-Author: Apache Solr Enterprise Search Server, 3rd Ed <https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw>	
This e-mail and all contents, including attachments, is considered to be Company Confidential unless explicitly stated otherwise, regardless of whether attachments are marked as such.


Re: Zk big files issues and model store

Posted by "Christine Poerschke (BLOOMBERG/ LONDON/ V)" <cp...@bloomberg.net>.
Hi Florin and Matthias,

Thanks for sharing about this!

Looking into where the JSON indentation in storage comes from -- from code reading only -- I think this is the code trail:
 * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/modules/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedModelStore.java#L46
 * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResource.java#L348
 * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResource.java#L238
 * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java#L443
 * https://github.com/apache/solr/blob/releases/solr/9.4.0/solr/solrj/src/java/org/apache/solr/common/util/Utils.java#L218-L227

Thinking out aloud ...

... how might storing the model in non-JSON format work? Haven't looked into.

... what are the concerns about DefaultWrapperModel usage, I'm guessing it's the split nature (i.e. the wrapper part of the model in ZK but the resource part on disk) -- is that so?

Looking at the https://solr.apache.org/docs/9_4_0/modules/ltr/org/apache/solr/ltr/model/DefaultWrapperModel.html javadocs for an example configuration and there noticing the

  "resource": "models/myModel.json"

element made me wonder ...

... what if the resource being wrapped was not external (giving rise to the split nature scenario) but internal inlined in the model?

... Yes, something like

  "content": "{ \"class\": \"org.apache.solr.ltr.model.LinearModel\", \"name\": \"myModelName\", \"params\": { ... } }"

would be a bit human-unreadable but would it save enough space?

And/Or could representation in non-JSON format be of interest in some use cases?

  "format": "foobar",
  "content": " ... model representation in foobar format goes here ... "

https://github.com/apache/solr/pull/2018 explores the AlternativeFormatWrapperModel idea.

Hope that helps.

Best wishes,
Christine

From: users@solr.apache.org At: 10/16/23 15:02:23 UTC+1:00To:  users@solr.apache.org
Subject: Re: Zk big files issues and model store

Hi Florin,

What has worked for me was making model deployment a software deployment
task and bundling the model
in the JAR I deployed with Solr as the DefaultWrapperModel also loads
resources from the classpath.

Cheers
Matthias


On Sun, Oct 15, 2023 at 8:54 AM Florin Babes <ba...@gmail.com> wrote:

> Hello,
> We reached the limit of zk for storing LTR models. I want to avoid the
> usage of DefaultWrapperModel for as long as possible because we have
> deployed in an container orchestrator and this implementation can be
> really risky if you can not guarantee the presence of the model on
> disk all the time.
> So I want to use the managed model feature to upload some bigger
> models but zk is dying with OOM. What we noticed is that solr stores
> the models in a json indented file. By saving the models in compacted
> json our models will be 60% smaller.
> Do you think that we should try to implement this? Could this work and
> allow us to postpone the moment of using DefaultWrapperModel?
> Thanks,
> Florin Babes
>



Re: Zk big files issues and model store

Posted by Matthias Krüger <mk...@opensourceconnections.com>.
Hi Florin,

What has worked for me was making model deployment a software deployment
task and bundling the model
in the JAR I deployed with Solr as the DefaultWrapperModel also loads
resources from the classpath.

Cheers
Matthias


On Sun, Oct 15, 2023 at 8:54 AM Florin Babes <ba...@gmail.com> wrote:

> Hello,
> We reached the limit of zk for storing LTR models. I want to avoid the
> usage of DefaultWrapperModel for as long as possible because we have
> deployed in an container orchestrator and this implementation can be
> really risky if you can not guarantee the presence of the model on
> disk all the time.
> So I want to use the managed model feature to upload some bigger
> models but zk is dying with OOM. What we noticed is that solr stores
> the models in a json indented file. By saving the models in compacted
> json our models will be 60% smaller.
> Do you think that we should try to implement this? Could this work and
> allow us to postpone the moment of using DefaultWrapperModel?
> Thanks,
> Florin Babes
>