[MB-6392] Indexing 11 ddocs might push system into swap pretty quickly Created: 22/Aug/12  Updated: 30/Sep/12  Resolved: 30/Sep/12

Status: Closed
Project: Couchbase Server
Component/s: view-engine
Affects Version/s: 2.0-beta
Fix Version/s: 2.0
Security Level: Public

Type: Bug Priority: Major
Reporter: Karan Kumar (Inactive) Assignee: Karan Kumar (Inactive)
Resolution: Fixed Votes: 0
Labels: 2.0-beta-release-notes, system-test
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment: 1617
Centos 64 bit.

Attachments: PNG File Screen Shot 2012-08-22 at 6.40.45 PM.png    

 Description   
1 bucket.
6 GB bucket, 8 gb system ram,
10M items
40% active and resident ratio.

It seems like that indexing 11 ddocs with 2 views each, seems to push the system into swap, pretty fast.
Seeing this on 2.0 large cluster, with similar setup as well.
What are the bounds for 2.0 when someone wants to use indexes and upto how many?

See the screenshot attached for what we are seeing, in the functional tests.

Views:-
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d1' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.key_num);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,doc.key);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d2' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.name);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.key_num]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d3' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.email);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.name]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d4' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.city);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.email]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d5' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.country);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.city]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d6' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.realm);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.country]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d7' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.coins);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.realm]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d8' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.category);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.coins]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d9' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.achievements);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.category]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d10' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.body);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.achievements]);\n}"} }}'
curl -v -X PUT -H 'Content-Type: application/json' 'http://saslbucket:saslpass@localhost:8092/saslbucket/_design/d11' \
   -d '{"views": { "v1":{"map":"function(doc){\nemit(doc.key,doc.city+doc.country);\n}"}, "v2":{"map":"function(doc,meta){\nemit(meta.id,[doc.key_num,doc.body]);\n}"} }}'

 Comments   
Comment by Karan Kumar (Inactive) [ 22/Aug/12 ]
The views dont emit lot of stuff, some small properties of the document.
Comment by Karan Kumar (Inactive) [ 23/Aug/12 ]
We are going to run some more experiments to understand this better.

All these test have been run on centos 5.6
Run on ubuntu 10.04. Different scheduler/filesystem?

Run with nobarrier mount option.
Comment by Karan Kumar (Inactive) [ 29/Aug/12 ]
From Alk:
Even more than that (assuming I'm not insane) is O(N^2) external sorting algorithm that we accidently implemented in couch_set_view_updater. Basically it keeps up to 16 1 meg files, then merges them to 1. Then continues with creating 15 1 meg files and merges everything together again. Then again, etc... It can be seen that this is quadratic behavior.
Generated at Tue Sep 02 20:23:34 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.