Skip to content
Back

Query timeout on 10 concurrent functions

  • 0
  • Self Hosted
  • Functions
  • Databases
ariel14526
23 Jul, 2025, 16:20

Hi,

I have appwrite 1.7.4 self hosted I have a Node.js function that does several operations:

  1. Query a collection to get a document, currently there is a single document in that collection and the query filters by a unique indexed field
  2. Upsert a document in another collection
  3. Query a document
  4. If the document of 3# doesn't exist, creates a document
  5. Insert a 200kb file to a bucket

All of this is done usually in under 400ms when I invoke it once

If I invoke this functions 10 times concurrently then around 40% of them fail on timeout even that I tried increasing the timeout to 30 (more fails, because it's a sync function)

90% of the time the problematic query that stucks is the one in the first operation.

What can I do to fix this? I have a vps with 4 cores and 8gb ram

I need it to be capable to handle more concurrent executions of this function

TL;DR
Issue: Query timeout occurring when running 10 concurrent functions in a Node.js application on Appwrite 1.7.4 self-hosted. Majority of failures are due to timeout during the first operation of querying a collection. Solution: To handle more concurrent executions, consider implementing the following: 1. Optimize the query in the first operation to reduce execution time. 2. Check the indexes on the collection to ensure optimal performance. 3. Increase the resources on the VPS hosting the application (e.g., consider CPU cores and RAM). 4. Implement caching mechanisms to reduce query load. 5. Consider asynchronous processing or queuing mechanisms to
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more