Skip to content

_replicate calls are extremely slow #2025

@tudordumitriu

Description

@tudordumitriu

We have noticed that even if there is almost no load on CouchDB the _replicate call takes from 1 second to 5 seconds on the development machine and on the server it reaches even 15 seconds, which compared to standard execution time for a standard call (GET, PUT doc which is around 0.01 seconds) seems to be extremely slow.

We are using _replicate calls with doc_ids (varying from one to few items up to hundreds/thousands) to replicate various changes to user db's (we are using per user database).

This behavior is reproducible on development machine (CouchDB 2.3.1) and as well on staging server (CouchDB 2.1.1)

Steps to Reproduce (for bugs)

  1. Standard replication call
    URL: "http://sa:replacedPassword@localhost:5984/_replicate"
    BODY: "{"source": "http://sa:replacedPassword@localhost:5984/userdb-6465763830","target": "http://sa:replacedPassword@localhost:5984/userdb-78" , "doc_ids" : ["l_11b7d2bd75d444d4947fa4cecf985767_org.couchdb.user:x"] }"
  2. Average execution time is around 3s (on a warmed up instance)
  3. I have attached for the above call the couchdb.log (log level = debug)
    couch.log

Context

Our db architecture:

  • Client PouchDB
  • Server CouchDB - Per user db
  • Server CouchDB - Central DB (only a subset of each PerUser db gets replicated to the CentralDB using https://github.com/redgeoff/spiegel)
  • Shared Documents to multiple PerUser Databases (that have to go through advanced sharing validation) go to our API (https://github.com/redgeoff/spiegel listens to global_changes and calls our API) which calls the problematic _replicate
  • API is .Net web.api using https://github.com/danielwertheim/mycouch as a CouchDB client
  • At some point the server becomes unusable.Maybe not very useful but when we are replicating multiple documents the duration increases dramatically.serverReplicateCallsDuration.txt
  • This is perfectly reproducible using PostMan or any other tool

Your Environment

  • Version used: 2.1.1 to 2.3.1
  • Operating System and version (desktop or mobile): Windows 10 / Windows 2016 Server

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions