logged_in and caching
Posted: 21 April 2008 02:42 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  90
Joined  10-26-2007

Hi all,
I’m trying to understand how adding member services will affect the performance of my site.  What I’m specifically concerned about is how that classic “Login or Register” / “Welcome back mr X” link on top of all pages in my site will affect performance. Won’t that ruin every possibility of caching the pages?

I’ve searched a bit about and on this page in the docs it says “The logged in state of the user whose visit prompts the cache to be written will permanently affect the information displayed to all visitors.”

Does that mean that such a link would prevent caching - thus kill my server? I’ve also read some posts that indicate the opposite but I’ve not found a good explanation anywhere on how this really works.

J

Profile
 
 
Posted: 21 April 2008 02:48 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15409
Joined  05-15-2004
jensa - 21 April 2008 02:42 PM

What I’m specifically concerned about is how that classic “Login or Register” / “Welcome back mr X” link on top of all pages in my site will affect performance. Won’t that ruin every possibility of caching the pages?

No. EE caches on multiple leves, there is tag caching as well as SQL caching, eg. Both won’t be affected by an additional query to determine the logged-in user.

I’ve searched a bit about and on this page in the docs it says “The logged in state of the user whose visit prompts the cache to be written will permanently affect the information displayed to all visitors.”

That is only true for using {if logged_in} / {if logged_out} inside a Weblog Entries tag on a cached template. While you can use that tag inside {exp:weblog:entries}, this is not necessary to provide a “Login / Welcome Back” link. Also, template caching is only one of the caching mechanisms.

 Signature 

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

Profile
MSG
 
 
Posted: 21 April 2008 03:07 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  90
Joined  10-26-2007

I’ve not touched any cache settings for my sites yet. From that doc, it looks like I should turn on Template caching (if it’s not already turned on by default?).

Anyway - I assume this means that every EE page is dynamic, but only the required queries will be executed upon each render. The total “punishment” for adding that link (login/welcome) should then be just a single SQL query?

J

Profile
 
 
Posted: 21 April 2008 03:23 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15409
Joined  05-15-2004
jensa - 21 April 2008 03:07 PM

I’ve not touched any cache settings for my sites yet. From that doc, it looks like I should turn on Template caching (if it’s not already turned on by default?).

It depends. There are situations where it’s not desirable, such as when you work with expiring entries, eg. Likewise, if your host has excellent db caching, turning on the SQL cache might actually slow things down, so… it depends.

Anyway - I assume this means that every EE page is dynamic, but only the required queries will be executed upon each render.

Every page is dynamic, but EE tries very hard to keep the number of SQL requests to a minimum.

The total “punishment” for adding that link (login/welcome) should then be just a single SQL query?

I can’t promise it down to this level of precision, but, as a rule, it does not impact your performance negatively. Just give it a try.

 Signature 

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

Profile
MSG
 
 
Posted: 21 April 2008 04:02 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  90
Joined  10-26-2007

Thanks Ingmar!
I’ll do some testing before I launch, but this sounds encouraging.

I’m on EngineHosting, so from what I’ve read, I shouldn’t turn on the DB caching. I don’t have expiring entries, but I do use future entries to some extent.


J

Profile
 
 
   
 
 
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: 64981 Total Logged-in Users: 25
Total Topics: 82022 Total Anonymous Users: 20
Total Replies: 440841 Total Guests: 171
Total Posts: 522863    
Members ( View Memberlist )
Newest Members:  Chris Bandytony leodennisbaldwinhazlett_davidkpspokeli9htcluizmbentsitjmattdennis3