Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

ebalduccio@gmail.com avatar image
ebalduccio@gmail.com asked Erick Ramirez commented

Getting WriteTimeoutException with Document API for large documents

I'm inserting JSON documents trough the ASTRA DB Document API, All the documents have the same structure but someones are bigger than others, then I'm getting:

{
    "description": "Server error: org.apache.cassandra.stargate.exceptions.WriteTimeoutException: Operation timed out - received only 0 responses.",
  "code": 500
}

Is there a way to increase the timeout to avoid this problem?

Thank you in advance.

stargate
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

The quick answer is there isn't a way to increase the timeout because in a lot of cases, the timeouts are in place as a guard rail to prevent requests from inadvertently overloading the underlying database.

Depending on how "large" your documents are, Astra DB propagates a timeout to the Stargate API by design for self-preservation. I use the word "large" a bit loosely too because there's some nuances to it.

The obvious notion for "large documents" is the size of the payload and I think most users already understand that. But there's also the idea that documents can be large when there are several layers of nested values. The maximum levels of nesting is 45 so if you are adding documents that go beyond that limit, the operation will timeout. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

The nesting is about 2 levels, is a simple large document, I'm going to upload here a sample.AAL-quarterly.json.zip

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ ebalduccio@gmail.com ·
Your document is quite large. I tried to count how many items there are in fiscal year but I just gave up in the end. :)

The sheer volume of elements in your document confirms why you got a write timeout exception. Cheers!

0 Likes 0 ·