Page 1 of 1

[SOLVED] slow page load with CGUserDirectory

Posted: Tue Jul 27, 2010 5:21 pm
by stevew
Hi,
Using CGUserDirectory, my page load times are very long. Compared to a time-to-first-byte of up to 1.5 seconds for other pages (it's not a particularly fast website!), on CGUserDirectory pages I get a TTFB of 20 seconds or more. This is measured using www.webpagetest.org.

Can anybody tell me whether this is normal and to be expected given the set-up described below? Is it due to having such a large number of user properties?

Server operating system: Linux 2.6.32.9-grsec On i686
Server software: Apache
Server database: MySQL
PHP version: 5.2.12

CMS-MS 1.8.1
CGUserDirectory 1.2.3
FrontEndUsers 1.10.1
CGExtensions 1.19

FrontEndUsers:
Number of users: 218
Number of groups: 1
Number of properties: 61

The 20+ second TTFB occurs when using a CGUserDirectory summary template that returns all or most of the 218 users; on a page using a summary template which selects a very small subset of users, the TTFB is much shorter (though it can still be 5 seconds or so).

Many thanks for your help,
Steve

Re: slow page load with CGUserDirectory

Posted: Tue Jul 27, 2010 6:49 pm
by calguy1000
Thanks for a post with enough information for us to be able to do some research on and help you.

The CGUserDirectory module accesses the FrontEndUsers tables directly.

It builds a query that matches the criteria you specify in the {CGUserDirectory} call, then selects matching users... this can be slow depending upon the criteria you select.

Secondly, for each matching user it needs to find the users member groups, and read all of the properties (so that you have the ability to view them in the summary view). 

So for 218 users in one summary view would be 1 (very complex one) + 2 * 218 = 437 queries.

You may be able to improve performance some by adding some indexes to the FrontEndUsers tables.

Re: slow page load with CGUserDirectory

Posted: Wed Jul 28, 2010 6:42 am
by stevew
Thanks, Calguy, that makes sense. I'll see about adding indexes to the FEU tables.

Re: [SOLVED] slow page load with CGUserDirectory

Posted: Thu Apr 07, 2011 2:19 pm
by vfreriks
Hello, I'm sorry to kick this thread but I'm trying to sort the CGUserDirectory output on a property called 'lastname'. This results in slower page loads. I added an index on the 'title' column of the feu_properties table. Is this correct or should I add it to the 'value' column?
Thanks in advance.