azure-contrib / AzureDirectory

A Lucene Directory Provider for Azure Blob Storage
Microsoft Public License
77 stars 57 forks source link

Default Cache should not be file based #25

Open ManfredLange opened 7 years ago

ManfredLange commented 7 years ago

At present if the cacheDirectory parameter of the AzureDirectory constructor is null, AzureDirectory will default to creating a folder in the local file system.

While this may be fine for local development and for some deployment scenarios, it doesn't work if you deploy as an app service to Azure. You don't necessarily have write permissions.

I'd like to suggest that the default could be RAMDirectory() instead. Alternatively, AzureDirectory should not make an assumption that write permission exists for the local file system. Instead AzureDirectory should require the explicit specification of a cache directory object.

In our case we experienced a short downtime in one of our production deployments that would have been avoidable. We resolved it by passing "new RAMDirectory()" as the value for parameter cacheDirectory to the constructor of AzureDirectory().

richorama commented 7 years ago

Sorry to hear about your downtime.

What do you think about not having a default, and forcing the developer to choose?

ManfredLange commented 7 years ago

Yes, I think that would be an improvement. If you choose that option perhaps it might make sense to review the intro page here on Github as well as the example code. Just a thought.

An additional option would be to suggest using path "d:\home\site" for the location of the cache directory. This is a faux directory that is available to app services on Azure (for details see https://docs.microsoft.com/en-us/azure/app-service-web/web-sites-available-operating-system-functionality). A SimpleFSDirectory at d:\home\site is also the option we went with in the end as it turned out that the RAMDirectory() was running into OutOfMemoryExceptions very quickly.