Getting Timeout error while Querying on large data bucket

Hello Guys,

I am using below Environment:

Version 4.1.0-4908 Enterprise Edition (build-4908)
Couchbase .NET SDK version: 2.2.1

When I am querying on 1000 records the result is fine, but when I went to query with 100000 records the query result hangs and it gives me below time-out error.

((System.Net.WebException)(((Couchbase.N1QL.QueryResult<object>)(result)).Exception))
"The operation has timed out"
"at System.Net.HttpWebRequest.GetResponse()\r\n   at Couchbase.N1QL.QueryClient.Get[T](Uri requestUri)"

I have added a property to set client side and server side time out as same as:
Client configuration:
DefaultOperationLifespan = 6000000,
QueryRequestTimeout = 6000000

Server configuration:
var query = new QueryRequest(sN1QLQuery).Timeout(new TimeSpan(0, 0, 0, 0, 6000000);

Can any one help me on solving this.

Regards,
Rajeev Diboliya

1 Like

I’d highly recommend you upgrade to the released build number 4.1.0-5005
thanks
-cihan

Hi @raj311289

I can see that you are setting the timeout value on the QueryRequest object, but can I ask you to try and set the ViewRequestTimeout to the same value?

var config = new ClientConfiguration
                {
                    
                    ViewRequestTimeout = 6000000,
                };
ClusterHelper.Initialize(config);

                ClusterHelper
                    .GetBucket("default")
                    .Query<dynamic>(
                        new QueryRequest("sql")
                        .Timeout(TimeSpan.FromSeconds(1000))
                    ); 

According to this ticket it should work when using sync method calls, Loading...

Hi Rajeev,

It would be good if you can provide the query and the EXPLAIN for the query.
Here’s the gist of timeout behavior from the server.

  1. Query engine itself has default timeout set to never (timeout = 0).
  2. You can explicitly change it to a finite value using curl (examples below).
  3. When the query uses GSI index, it has a default index scan timeout of 120 seconds.
    The sample query and explain will help where the timeout is happening.
    Also, can you try the query directly via curl or cbq and share the output.

$ curl -u Administrator:password http://localhost:8093/admin/settings > z.json
edit z.json and change the timeout value.
$curl -u Administrator:password http://localhost:8093/admin/settings -XPOST -d@./z.json

Hi @cihangirb, thanks for the reply,

I have installed the latest build as you mentioned (4.1.0-5005).
After installing the query returns records but it is taking too much time for getting just 10 records out of 100000 total documents.

also I am getting below error with the result.

Code - 12015
Message - Index scan timed out - cause: Index scan timed out

Regards,
Rajeev

1 Like

Hi @martinesmann, thanks for the reply,

I have tried with the code you have given (i.e setting ViewRequestTimeout value), but it is giving the same error output.

Regards,
Rajeev