2

Based on the subdomain that is accessing my application I need to include a different configuration file that sets some variables used throughout the application (the file is included on every page). I'm in two minds about how to do this 1) Include the file from GCS 2) Store the information in a table on Google Cloud SQL and query the database on every page through an included file.

Or am I better off using one of these options and then Memcache.

I've been looking everywhere for what is the fastest option (loading from GCS or selecting from cloud SQL), but haven't been able to find anything.

NB: I don't want to have the files as normal php includes as I don't want to have to redeploy the app every time I setup a new subdomain (different users get different subdomains) and would rather either just update the database or upload a new config file to cloud storage, leaving the app alone.

  • 1
    Good question - my instinct is to say GCS is better designed for simple get/put of static content. Of course (depending on the size of the file) you can still look at caching it once you've fetched it. – tx802 Mar 03 '14 at 19:47
  • 1
    Whatever option you choose, it makes sense to cache the file in memcache, so your application doesn't need to reload it for every request. – Brian Dorsey Mar 03 '14 at 19:55

2 Answers2

1

I would say the most sane solution would be to store the configuration files in the Cloud SQL as you can easily make changes to them even from within the app and using the memcache since it was build exactly for this kind of stuff.

The problem with the GCS is that you cannot simply edit the file and you will have to delete and add a new version every time which is not going to be optimal in a long run.

Lipis
  • 21,388
  • 20
  • 94
  • 121
  • @AndreiVolgin Nothing wrong but maybe I had something else in my mind when it comes to the configuration.. if it is more like .config file that is needed somewhere by PHP then it might makes more sense.. I was thinking more if the settings were pore like properties of a table or something.. – Lipis Mar 03 '14 at 16:29
1

GCS is cheaper, although for small text files it does not matter much. Otherwise, I don't see much of a difference.

Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58