Greetings,
I have a server cluster made with 2 nodes, but only one of them has index and query services active.
Recently queries have been quite slow, and for that I have 2 questions:
Will the query performance improve if I add the query and index services to the 2nd node? And is it posible to do while the node is active or do I have stop the couchbase-server service on the 2nd node and then add the services?
Hi @jeav148,
To answer your second question, as far as I know, you can’t add services to a node after it’s already started. This is a feature request in the backlog: MB-15357
However, to answer your first question: adding index and query services to another node isn’t necessarily going to make your query faster. It depends on a number of factors:
- What is the query?
- What does “quite slow” mean? 1 query is taking too long? The query being executed under a highly-concurrent load is taking too long?
- Is there a better index that you can use to improve performance?
- Maybe switching to Memory-Optimized Indexes will give you a boost.
- Index partitioning/index replication might also help
I would recommend asking in the N1QL forum about your query (if you haven’t already), seeing if there’s a better index, and then exploring the other possibilities of scaling if necessary.
Hi @matthew.groves! Thanks for the answer
The query that is giving me issues was implemented almost a year ago, and took around 1 - 2 seconds in retrieving data. Suddenly from a week past it is taking around 13 to 17 seconds. Could the indexes not be working? I will take your advice on this and go to the N1QL forums.
There has not been any significant spike in users or documents creation, wich is why I dont get where the slowness might come. A few things I noticed that might be the problem:
- Server is using swap memory, since it is slower, should I remove the swap?
- Getting a lot of “Operation over threshold” warnings when running queries on the server.
- I have a warning in another bucket, “Metadata overhead” about deleted documents taking too much space (around 50%), could it affect?
Edit: Adding query for clarity - simplified the select but the rest is the same
select ds.DataControl as dataCtrl, ds.channels as dsChannels, ds2.channels as ds2Channels
from DataStorage ds
inner join DataStorage ds2 on keys (ds.DataControl.couchbaseId)
where ds.type="control" and ds.DataControl.clientNumber = 1234
I have indexes created for clientNumber, type and couchbaseId