Scaling horizontal vs vertical


#1

Hi,

Does CB recommend scaling horizontally or vertically first? Move to a multi server environment or increase resources on a single N1QL server?

Also - why? :smile:

Thanks!


#2

Is your question specific to the query service, i.e. N1QL service, or CB in general?


#3

@geraldss its more specific for N1QL since we see really really high CPU usage when firing queries. We often see 100% CPU for the duration of queries (yes, with indexes on them).

For CB in general, I’d scale horizontally.


#4

Got it. First, I would suggest putting CB Data, Index, and Query services on separate nodes. For the query service, you should scale as follows: if a single instance of a single query is consuming a lot of CPU, then you need to first scale up. If the high CPU consumption is due to multiple concurrent queries (whether same query or different queries), then you will benefit from scaling out. Scaling up would help as well, but scaling out is more scalable in this case.


#5

Thanks @geraldss

I agree - I think I need to scale up first since I’m getting a timeout on index scans - which I presume would not benefit from horizontal scaling? Would throwing in more cores help the index return data within the 2 mins its allowed?


#6

Well, I was referring to scaling the query service. The index timeouts are a separate issue, specific to the indexing service. For those, you should relax the 2 minute timeout. We have a REST API and CLI command to do that; it is posted on another question somewhere on the Couchbase forums (and in the documentation as well).


#7

@whollycow007 @geraldss

The way to increase the indexer timeout is as follows :
/opt/couchbase/bin/cbindex -type config -ckey indexer.settings.scan_timeout -cval 180000

However, the indexing team doesn’t not recommend changing this setting, they say that it can cause increased memory usage on the indexer.

For this use-case where pretty much all the keys need to be indexed, view indexes might be a better option because of the fact they are hash-partitioned and will scale well horizontally.

Cheers,
Manik