We use Azurite in our development environment for blob storage, including for running tests. I noticed that the performance of the tests have degraded with time, and eventually narrowed it down to poor performance with regards to Azurite. We are not putting a high load on Azurite, so it seems odd that it would be a bottleneck.
What reasons might exist for Azurite blob storage operations to degrade over time?
The performance degradation can happen when Azurite blob storage has lots of data. In our case, we have decided to design our integration tests to work regardless of starting state, which means that we don’t need to (and generally don’t) clean up data. As such, the data in Azurite grew over time, to the point that it became a performance issue.
There are a number of steps that can be taken here:
- Simply remove the existing storage. We are running Azurite in a container, so this is pretty straight-forward, but it does mean that developers will need to periodically deal with cleaning up storage.
- For tests, take advantage of the in-memory Azurite option as described here: https://www.joelverhagen.com/blog/2023/11/azurite-in-memory. This is the solution we went with for a couple of reasons, including:
- No orphan data created in azurite, so no need to worry about cleaning up Azurite storage
- Runs a little faster, maybe?