Replies: 3 comments 2 replies
-
There is no caching of views (except on disk as .mrview files). What I think you are seeing is the memory usage of couchjs processes as they process document updates and transform them to view rows. Once a view is built this no longer happens. It sounds like you've raise max_dbs_open higher than your memory allows, though these numbers seem low to me. c.f cloudant nodes have 1-2x that amount of ram and we open many more dbs at once than your setting. Perhaps your documents are, on average, quite large? Connections won't be closed by couchdb unless a crash occurs, node is rebooted (or its host is rebooted, obviously), or deliberately asking for this (with Noting that the config item Finally, I can confirm that 5GB of data is well within couchdb's abilities, it's tiny. however, I suspect that is primary data and not including indexes. Can you give a ballpark figure for how many databases/documents/design documents/views you have here? |
Beta Was this translation helpful? Give feedback.
-
Like @rnewson mentioned Keeping continuous connections open might not be the best strategy. The replicator for instance, doesn't do that. It sets a So, for instance, you can make your clients timeout, sleep a bit with some random backoff, and then connect against. That would give the time to for some db handles to close if you also set
If it is the couch_js processes which take up the memory and not beam.smp you can try adjusting os_process_limit or |
Beta Was this translation helpful? Give feedback.
-
I should have added "other than when forcibly closed by the LRU behind max_dbs_open" but I figured it was implied. |
Beta Was this translation helpful? Give feedback.
-
I am working on a very large implementation of couchdb across multiple scaled VMs, and have ran into some issues regarding memory use and db connection protocols. As discussed here, we had an issue where instances with 32GB of MEM would quickly run OOM due to view processes caching too much data. A quick fix I found was to set the
max_dbs_open
value to some % ratio of the total db shards available, which forced connections to close periodically, killing the view processes associated and freeing up memory. The results of this change were dramatic, with memory reduced by ~80% (40-56GB used to serve ~5GB of data -> 8-10GB used), however this has caused knock-on effects for our Software Defined Stores, and hence our largest customers (7k+ stores).One issue we have is in the closing of continuous connections used for changes feeds. Because couch gives no way to prioritise one connection type above another, we have no way to ensure that all continuous feed connections are maintained, while memory intensive view caching connections are closed. This causes a bunch of issues for us upstream, as we require the changes feed connections to be maintained to allow seamless modification of data without risking a race condition. We have experimented with upping the ratio of
max_dbs_open/db_shards
in the hope that continuous connections were already prioritised, and that with enough spare they would remain open, but to no avail, as regardless of how high this value is set some continuous connections are still closed.A possible alternative to fiddling with this value would be to limit the amount of views cached, but to my knowledge there is no defined control of this. Is this the case, or have I missed an important config setting? If not, is there a somewhat hacky way to achieve this which couch would be happy with, e.g. manually closing a connection / killing a process associated with large quantities of views cached?
Alternatively, could we request a change that would allow the prioritisation of continuous connections over temporary, or limit the cache size of views? This is a priority issue for us, so any help you can offer would be hugely appreciated!
Thanks in advance! ^_^
max_dbs_open
>db_shards
(1200 > 804)max_dbs_open
<db_shards
(500 < 804)Beta Was this translation helpful? Give feedback.
All reactions