Giter Site home page Giter Site logo

Comments (9)

rnewson avatar rnewson commented on May 29, 2024 1

(obviously you'd also need to strip the comma to process "normal" format as a stream but this is simple.)

from couchdb.

rnewson avatar rnewson commented on May 29, 2024

until=now is the default behaviour (that is, if you don't ask for feed=continuous)

For any other value of until there is no solution, as you cannot construct a future update sequence string externally.

from couchdb.

ronag avatar ronag commented on May 29, 2024

until=now is the default behaviour (that is, if you don't ask for feed=continuous)

Exactly, would like to have it for feed=continuous which is much more efficient than normal.

from couchdb.

rnewson avatar rnewson commented on May 29, 2024

feed=continuous is as "efficient" as normal mode, it's the same code except it keeps reopening the database as it changes and sends the new updates. there is still no way for you to construct a future update sequence, and thus there's nothing you could pass as the until parameter.

I do not understand your need.

from couchdb.

ronag avatar ronag commented on May 29, 2024

normal feeds require several thousand http requests while continuous is a single streaming request. There is a significant difference in both overhead and latency. Even with tricks like keep alive and pipelining (I'm unsure how well those are actually supported).

from couchdb.

rnewson avatar rnewson commented on May 29, 2024

keepalive (multiple sequential send req, read resps on the same tcp connection) is supported (and encouraged!). pipelining (sending multiple requests before reading the first response) is also supported.

I still don't see how you could know what value to pass to until. Have you seen that the changes endpoint supports a limit parameter? perhaps that is what you mean (`from here, return the next 10,000 updates and wait until they happen)

from couchdb.

ronag avatar ronag commented on May 29, 2024

keepalive (multiple sequential send req, read resps on the same tcp connection) is supported (and encouraged!). pipelining (sending multiple requests before reading the first response) is also supported.

That's great! However, from our tests it's still a lot slower than a continuous feed in addition to that it takes more memory (at least on client side as we need a quite large batch size for optimal perf). Especially when running in clustered mode.

Feel free to close if you still don't think it makes sense.

I still don't see how you could know what value to pass to until.

I would have a previously saved sequence or just pass now

from couchdb.

rnewson avatar rnewson commented on May 29, 2024

are you perhaps buffering the entire response before processing it when not using feed=continuous? the response format is different, you see. for continuous we send a series of json objects separated by newlines. for normal, it's a single json object with all the docs within that. however we do intentionally put newlines between the items to make it easier to process in a streaming manner.

normal:

curl foo:bar@localhost:25984/db1/_changes
{"results":[
{"seq":"1-g1AAAABzeJzLYWBgYMpgTmHgz8tPSTVyMDQy1zMAQsMckEQiQ1L9____sxIZcCrJYwGSDA1A6j9IZQZzImMuUIDdzMIiNS0lDVNXFgCFqx2b","id":"doc1","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]},
{"seq":"2-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTVyMDQy1zMAQsMckEQiQ1L9____szKYExlzgQLsycZJyQZmSZjKcRqRxwIkGRqA1H8Uk8wsLFLTUtIwdWUBAG6aJN4","id":"doc2","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]},
{"seq":"3-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTVyMDQy1zMAQsMckEQiQ1L9____szKYE5lygQLsycZJyQZmSZjKcRqRxwIkGRqA1H-oSYxgk8wsLFLTUtIwdWUBAG8EJN8","id":"doc3","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
],
"last_seq":"3-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTVyMDQy1zMAQsMckEQiQ1L9____szKYE5lygQLsycZJyQZmSZjKcRqRxwIkGRqA1H-oSYxgk8wsLFLTUtIwdWUBAG8EJN8","pending":0}

continuous

curl 'foo:bar@localhost:25984/db1/_changes?feed=continuous'
{"seq":"1-g1AAAABzeJzLYWBgYMpgTmHgz8tPSTVyMDQy1zMAQsMckEQiQ1L9____szKYExlzgQLsycZJyQZmSZjKcRqRxwIkGRqA1H-QSYkMWQBNRh2D","id":"doc2","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
{"seq":"2-g1AAAABzeJzLYWBgYMpgTmHgz8tPSTVyMDQy1zMAQsMckEQiQ1L9____szKYE5lygQLsycZJyQZmSZjKcRqRxwIkGRqA1H-QSYkMWQBNkB2E","id":"doc3","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
{"seq":"3-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTVyMDQy1zMAQsMckEQiQ1L9____szKYE5lygQLsycZJyQZmSZjKcRqRxwIkGRqA1H-oSYxgk8wsLFLTUtIwdWUBAG8EJN8","id":"doc1","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}

from couchdb.

ronag avatar ronag commented on May 29, 2024

That's a good point!

from couchdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.