Open omerkMM opened 3 years ago
@omerkMM
As we see, the error is "ErrorName=SequelizeDatabaseError ErrorMessage=Timeout: Request failed to complete in 15000ms". This looks like the error is caused by slow network or responds from sql. If you looks into the sql server log, you might can find more hint, by see if the request from azurite is received and returned by sql server in time.
Besides that, "10-15 requests per second" looks is not too heavy. Can you still repro the issue with azurite run with loki, instead of sql?
Thanks for the reply, it helped We removed the DB connection (which defaults to loki) and things look stable
After further investigation on our end for the root cause of the issue when using a persistent DB connection, we found out the following
Azurite uses sequelize upsert commands Sequelize is translating this command a MERGE INTO statement for the SQL Server MERGE INTO statements is blocking records on the page level so it’s blocking a lot of update statements (that appear on the same page in the DB) This is what’s causing records to be locked for a long time If there are a lot of MERGE INTO statements, they are waiting on each other (each is blocking a whole page and waits for the previous one to finish) A more efficient approach would be to stop using upset and instead to use get and then insert/update
@omerkMM
Good to know the issue resolved on your side with Loki! We will look into the SQL issue you mentioned.
I have also tested to use Azurite with an external DB (MSSQL). Idea was/is, to use multiple Azurite instances behind a load balancer to achieve better performance. My finding is, that even when using only one Azurite instance with an external MSSQL DB, I see multiple locks on the DB when Azurite is accessed in parallel (multiple threads reading/writing to Azurite). The locks finally lead to timeouts and in consequence to exceptions being thrown. This renders the external DB feature pretty useless in current state (Azurite 3.15.0) in my opinion. At least with MSSQL.
@devax Thanks for the information! Azurite SQL support is still in preview, we will investigate it when bandwidth available.
However, Azurite welcome contribution! All the SQL related API are called in same file in Azurite https://github.com/Azure/Azurite/blob/main/src/blob/persistence/SqlBlobMetadataStore.ts, like this line. It would be great if you could help to change the SQL call (per @omerkMM 's comment, change the SQL call might can fix it ), and test if it works for your scenario. And if it works for you scenarios, you can raise a PR to fix this.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
+1 im also having this issue
Which service(blob, file, queue, table) does this issue concern?
Blob
Which version of the Azurite was used?
3.14.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
Github
What problem was encountered?
As part of our automation tests. The Azurite is getting in high usage (Around 10-15 requests per second). some of the requests return with HTTP 500 errors.
Steps to reproduce the issue?
Send load of requests in a short time.
Log example from debug.log:
Notes:
Azurite is running on a single pod. We are using an external DB located in the same network as the Azurite. The issue doesn't happen when running the requests separately. There is no resource usage issue with withe pod/cluster.