Hi,
I'm currently looking into BigCouch as a way to manage a relatively small cluster of servers.
My current setup is
Zone #1
4 Nodes
Zone #2.
2 Nodes
Each node is an 8 core VM with 8GB of RAM.
My database was created with
N=3 (2 copies in Z1 and a single copy on Z2)
Q=16
Z=2
Initially things were looking promising. Using a simple load test which consisted of a PUT, GET and then DELETE I was able to get around 1300 requests per second. The problem happens when I add my validation function to the database. The function is simple and looks like this:
----------------------------
designDoc.validate_doc_update = function ( newDoc, oldDoc, userCtx ) {
if ( newDoc._deleted ) {
return;
}
var docIsNew = ( oldDoc == null );
// check that data type is the same - only for updates, not new or deleted docs
if ( !docIsNew && oldDoc.dataType != newDoc.dataType ) {
throw( { error: 'document type cannot be changed' } );
if ( !isNumberPositive( newDoc.book_version) ) {
throw( { error: 'wrong book version' } );
// new or deleted docs need no further checking
if ( !isNumberPositive( newDoc.article_version) ) {
throw( { error: 'wrong article version' } );
}
function isNumberPositive( value ) {
value = parseInt( value );
if ( isNaN( value ) || value < 0 ) {
----------------------
As soon as I add it I see my requests per minute drop to 300-400/s. As far as I can see this really shouldn't have too much of an effect since the Javascript isn't doing much other than checking if two numbers are positive. I add the validation through couchapp:
If anyone can help by pointing out something I'm doing wrong or a more efficient way of doing these types of checks that would really help me.
Thanks,
Alan