Is there performance hit running templates as text files?
Posted: 25 April 2008 11:46 AM   [ Ignore ]  
Grad Student
Rank
Total Posts:  31
Joined  04-02-2008

For development purpose, I run all templates as text files.  Now I have migrated the site to a live server.  Is there a performance hit or should I turn it off?

If I should turn it off on the live site, what’s are the recommended steps?  Do I go to every single template to reload the content, un-click the “Save Template as File” checkbox and save it into database.

Profile
 
 
Posted: 25 April 2008 12:27 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6092
Joined  08-04-2002

Don’t have any thread pointers but from everything I’ve read, there is no performance hit of any consequence, if at all.

Profile
 
 
Posted: 25 April 2008 08:07 PM   [ Ignore ]   [ # 2 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15869
Joined  06-03-2002

There is additional disk i/o for the file, of course, but it’s just read access, so unless you have an unusually high traffic site, I don’t think even anyone monitoring the server closely would notice a blip.  And if you _do_ have an unusually high traffic site, it’s likely that you already have a server environment with a disk array that can handle it.

That said, there is convenience to keeping it all in the database on a production site.  If your host (or you) make regularly scheduled database backups, then the templates are included with such a backup.  Perhaps not a big deal if you also make regular file backups, but I prefer to keep everything in one place when I can.

 Signature 
Profile
MSG
 
 
Posted: 28 April 2008 11:08 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Rank
Total Posts:  31
Joined  04-02-2008

Thanks to all.  I will leave the templates as text files then as it makes porting the template changes over much easier via FTP.

Profile
 
 
Posted: 28 April 2008 11:43 AM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6092
Joined  08-04-2002

Once a site is live and stable, I usually take it into the database as I’m rarely accessing with anything major. It is kind of a pain as you need to visit every template, switch the file save off and refresh. Wished there was a master switch :-)

Profile
 
 
Posted: 28 April 2008 01:29 PM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

A master query, perhaps?

UPDATE exp_templates SET save_template_file = "n" WHERE save_template_file = "y"

Untested, so use at your own risk smile

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 28 April 2008 02:19 PM   [ Ignore ]   [ # 6 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6092
Joined  08-04-2002

Thanks Ingmar, don’t have anything to test on at the moment but have the code so will try when possible.

Profile
 
 
Posted: 28 April 2008 02:21 PM   [ Ignore ]   [ # 7 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15869
Joined  06-03-2002

Well, you still need to save via the form, or EE will serve the potentially-stale database version of the template.

 Signature 
Profile
MSG
 
 
Posted: 28 April 2008 02:25 PM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

Ouch, good catch there. So, there’s no way to fully automate that, Derek?

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 28 April 2008 02:32 PM   [ Ignore ]   [ # 9 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15869
Joined  06-03-2002

Well, no one-line way.  A quick PHP script in a template could handle it, grabbing content from files of all saved templates, and updating the database.

 Signature 
Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65087 Total Logged-in Users: 32
Total Topics: 82229 Total Anonymous Users: 20
Total Replies: 441929 Total Guests: 200
Total Posts: 524158    
Members ( View Memberlist )