1

I am running a Rails app on Bluemix and want to use carrierwave for file uploads. So far no problem as I am using external storage to persist the files (ftp, s3, webdav etc.). However, in order to keep performance well I need to enable caching with carrierewave_backgrounder - and here it starts to get tricky. Thing is that I need to specify a temp folder for backgrounding the upload process (temp folder where the file remains before it is persisted on the actual storage), which is shared between all possible workers and app instances. If so at all, how can this be achieved?

Günther
  • 33
  • 6

2 Answers2

0

Check out Object Storage - you can store files and then delete them when you no longer have a need for them. Redis is another option, as are any of the noSQL databases available on Bluemix.

Daniel Toczala
  • 522
  • 2
  • 15
  • Thanks for you reply @Daniel. Do you have experience with such a setup? I am wondering if it is fast enough for caching as the cache store would be again some "remote" service? – Günther Jun 13 '17 at 08:34
  • Never done this myself - I just know that it CAN be done. Might be worth checking out and then determining the latency times. Even though these are "remote" services, they will reside within the same Bluemix region, organization and space. This means that they are within the same data center, so it is not a case where you have a lot of "travel time" between services. – Daniel Toczala Jun 13 '17 at 14:02
  • This would imply to implement a Redis or ObjectStore caching strategy as this does not come out of the box with carrierwave, right? Haven't found something I can immediately reuse. Weird that such a quite common use case is not covered in an "official" way. – Günther Jun 16 '17 at 15:02
0

typically in any cloud you never store on a file system of your VM or PaaS environment - reason being when you scale out, you have multiple VMS and a file written on one VM will not be available when 100s of VMs come up. The recommend practice is to look for storage services that the cloud platform provides. In Bluemix you have Storage options such as Cloud Object Storage, File Storgae and Block Storage.

As suggested before - you can take a look at the cloud object storage and utilize the service. Here is the documentation for Cloud Object Storage: https://ibm-public-cos.github.io/crs-docs/?&cm_mc_uid=06526771022514957173672&cm_mc_sid_50200000=1498597403&cm_mc_sid_52640000=1498599343. This contains quick start guide, storing, retrieving and API usage. Hope this helps.

kashyapa
  • 1,606
  • 1
  • 10
  • 13