You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Cameron Jacobson <ca...@datashovel.com> on 2013/08/16 17:33:57 UTC

best way to "warm" views offline

What is the best way to "warm" views offline?  Also, if possible, can
you explain the mechanics that CouchDB uses in order to "know" that a
given view is or isn't new?  In other words, when deploying an updated
design document how would the server go about determining whether a
given view within that design document is different or not?  Is it
through hashing?  Or do all views within the design document require a
pre-deployment query?

None of my datasets have ever really been big enough to required offline
prepping of views, but I'm anticipating this will change soon so I want
to make sure I'm using best practices when I'm ready to make this change
to my deployment process.

Thanks

Re: best way to "warm" views offline

Posted by Stefan Kögl <ko...@gmail.com>.
Hi Cameron,

I think you're looking for
https://wiki.apache.org/couchdb/How_to_deploy_view_changes_in_a_live_environment


-- Stefan


On Sun, Aug 18, 2013 at 10:29 AM, Cameron Jacobson
<ca...@datashovel.com>wrote:

> Right, I get all that.  But I've always imagined ideally my app would be
> serving requests while the new index is building.  Once the new index is
> built, then I deploy my new version of the app and "flip the switch" so
> that now my app is serving off of the newly indexed views.
>
> One way I've anticipated doing this is by versioning the design document
> (ie. _design/version1, _design/version2).  But more interested in best
> practices here.
>
> Thanks
>
>
>
> On 08/16/2013 06:57 PM, Filippo Fadda wrote:
> > You can only "warm up" your views querying them. You can use cURL from
> your command line. This will cause the creation of an index file per design
> document. This index file is updated each time another query is made on a
> view defined inside the design document. A view is never updated when you
> insert a document, but when you query the view itself. For performance
> reasons you can choose to avoid the index update when you query a view, but
> the results will not include the documents inserted since last query.
> Anyway you must force this behavior using a query parameter. The index
> creation requires time, but the index update is generally fast enough.
> > So, the best approach is querying all the views when you deploy the
> application, because indexing is a slow process. You can do that with a
> bash script. Eventually, you can query multiple views at the same time, so
> you can benefit of a multi-core architecture.
> >
> > -Filippo
> >
> > On Aug 16, 2013, at 5:33 PM, Cameron Jacobson wrote:
> >
> >> What is the best way to "warm" views offline?  Also, if possible, can
> >> you explain the mechanics that CouchDB uses in order to "know" that a
> >> given view is or isn't new?  In other words, when deploying an updated
> >> design document how would the server go about determining whether a
> >> given view within that design document is different or not?  Is it
> >> through hashing?  Or do all views within the design document require a
> >> pre-deployment query?
> >>
> >> None of my datasets have ever really been big enough to required offline
> >> prepping of views, but I'm anticipating this will change soon so I want
> >> to make sure I'm using best practices when I'm ready to make this change
> >> to my deployment process.
> >>
> >> Thanks
>
>

Re: best way to "warm" views offline

Posted by Cameron Jacobson <ca...@datashovel.com>.
Right, I get all that.  But I've always imagined ideally my app would be
serving requests while the new index is building.  Once the new index is
built, then I deploy my new version of the app and "flip the switch" so
that now my app is serving off of the newly indexed views.

One way I've anticipated doing this is by versioning the design document
(ie. _design/version1, _design/version2).  But more interested in best
practices here.

Thanks



On 08/16/2013 06:57 PM, Filippo Fadda wrote:
> You can only "warm up" your views querying them. You can use cURL from your command line. This will cause the creation of an index file per design document. This index file is updated each time another query is made on a view defined inside the design document. A view is never updated when you insert a document, but when you query the view itself. For performance reasons you can choose to avoid the index update when you query a view, but the results will not include the documents inserted since last query. Anyway you must force this behavior using a query parameter. The index creation requires time, but the index update is generally fast enough.
> So, the best approach is querying all the views when you deploy the application, because indexing is a slow process. You can do that with a bash script. Eventually, you can query multiple views at the same time, so you can benefit of a multi-core architecture.
>
> -Filippo
>
> On Aug 16, 2013, at 5:33 PM, Cameron Jacobson wrote:
>
>> What is the best way to "warm" views offline?  Also, if possible, can
>> you explain the mechanics that CouchDB uses in order to "know" that a
>> given view is or isn't new?  In other words, when deploying an updated
>> design document how would the server go about determining whether a
>> given view within that design document is different or not?  Is it
>> through hashing?  Or do all views within the design document require a
>> pre-deployment query?
>>
>> None of my datasets have ever really been big enough to required offline
>> prepping of views, but I'm anticipating this will change soon so I want
>> to make sure I'm using best practices when I'm ready to make this change
>> to my deployment process.
>>
>> Thanks


Re: best way to "warm" views offline

Posted by Filippo Fadda <fi...@programmazione.it>.
You can only "warm up" your views querying them. You can use cURL from your command line. This will cause the creation of an index file per design document. This index file is updated each time another query is made on a view defined inside the design document. A view is never updated when you insert a document, but when you query the view itself. For performance reasons you can choose to avoid the index update when you query a view, but the results will not include the documents inserted since last query. Anyway you must force this behavior using a query parameter. The index creation requires time, but the index update is generally fast enough.
So, the best approach is querying all the views when you deploy the application, because indexing is a slow process. You can do that with a bash script. Eventually, you can query multiple views at the same time, so you can benefit of a multi-core architecture.

-Filippo

On Aug 16, 2013, at 5:33 PM, Cameron Jacobson wrote:

> What is the best way to "warm" views offline?  Also, if possible, can
> you explain the mechanics that CouchDB uses in order to "know" that a
> given view is or isn't new?  In other words, when deploying an updated
> design document how would the server go about determining whether a
> given view within that design document is different or not?  Is it
> through hashing?  Or do all views within the design document require a
> pre-deployment query?
> 
> None of my datasets have ever really been big enough to required offline
> prepping of views, but I'm anticipating this will change soon so I want
> to make sure I'm using best practices when I'm ready to make this change
> to my deployment process.
> 
> Thanks