To start I checkboxed "Save As File" for everything. EE Templates and Low Variables. I was reading on performance and from what I can tell, doing that, save as file is a performance drainer. Can anyone verify that, should I uncheck the option?
2 Answers
Lol wut? Unless your database is behind a caching service (like memcache) and therefore loaded in memory, grabbing your files from your database is much more overhead. Where do you think database files are stored ;) ? They are on hard drives too. A well tuned, cached database would be faster for reads, but if you don't have that going on, saving as a file is much better. It also allows you to edit your template files with the editor of your choice, and well as set your templates in a repository.
Save as file is undoubtedly way better than just hitting the database. The only place it hurts is if you use the EE template editor, than on write you'll be hitting both the database and writing the file, but seriously, are you saveing templates through the EE template editor at a rate of 20 or 30 times a minute all day? Nope. Reads, however, just hit the file (when someone visit a page on your site). Which is definitely faster.
-
Right, db is more intensive, but that is what I was looking for, when the call is made, is it coming from the file or database. When I check mark that option, how does it work, does it send it from file or the database when the page is called? I was thinking the save file was more for us to edit in Sublime or Dreamweaver, etc. BTW, I am no dev, so I appreciate your help.– VinCommented Jun 18, 2015 at 23:58
-
Vin, it's coming from the file when the page template is called up for rendering. If you set your templates to save as files, and you never use the ee template editor, your database version of the template doesn't get updated until you use the ee template editor. Think about it; if you save as files and never use the ee template editor, what function keeps the database up to date on the template code? Nothing! Commented Jun 19, 2015 at 1:43
-
Sorry, to be clear, if you save as file for templates, ee doesn't query your database for that template code (unless the template file for it disappears, then it fails over to the database code) Commented Jun 19, 2015 at 1:47
-
Ah yes, thanks! That was not clicking until you wrote that last response. Really appreciate the answer.– VinCommented Jun 19, 2015 at 4:05
Enabling Save As Files in Low Variables does have a slight performance impact. In order to tie in to native EE functionalities, LV needs to update the native exp_global_variables
table with the data gathered from the files. This means, in contrast to what jchrono-battle is saying, EE does not load from the DB or filesystem, as far as LV is concerned. Rather than that, the files are synced from/to the DB and then loaded from the DB later on in the process. When not saving as files, the first step is skipped.
My advice would be to use the Save As Files option only in development environments, and don't use it in production sites.
-
I really appreciate you chiming in, I know it's your baby so you know it best. I will undo the Save As option, and I am glad you made that easy :) Low Variables is an insanely good add-on, I may even have over used it lol.– VinCommented Jun 19, 2015 at 14:07
-
@Low erk; would you suggest aggressive caching in production (like CE Cache, etc) to avoid issues with LV? Commented Jan 17, 2016 at 8:25