ariel14526Original post
Web Developer
Hi,
I have appwrite 1.7.4 self hosted
I have a Node.js function that does several operations:
- 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
- Upsert a document in another collection
- Query a document
- If the document of 3# doesn't exist, creates a document
- 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
Summary
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