poor performance for logged in users

poor performance for logged in users

by Frank Chmely -
Number of replies: 12

When not logged in, the site works fine. After I log in, it takes 10 to 15 seconds for each page to load. Any suggestions? Thanks.

Moodle 2.2.7+
Shared hosting
MySQL 5.0.96
PHP 5.3.14
"Use database for session information" is NOT selected

PS -- I first posted this in the "General" forum. Hope it's OK to also post it here.

 

Average of ratings: -
In reply to Frank Chmely

Re: poor performance for logged in users

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Read the initial pointers in the introduction to this (Hardware and Performance) forum.

P.S. as co-moderator. It is not OK to cross post: http://docs.moodle.org/en/Moodle.org_forums_Code_of_Conduct#Post_your_question_in_one_forum_only. Ask the moderator of the "General problems" forum to delete the that thread. "Hardware and Performance" is the right place.
In reply to Visvanath Ratnaweera

Re: poor performance for logged in users

by Frank Chmely -

I added a reply to my post in "General problems", asking the moderator to delete it.

I have read the Performance pages in the Moodle documentation.  It's not a question of the server being overworked, as the problem appears when I'm the only one accessing the site.  (I also spoke to the hosting company, and they don't see any problems.)  It doesn't seem to be a database problem either, as the database test page (which runs some thousands of queries) doesn't take much longer than any other page.  PHP seems to be configured correctly, in accordance with the docs (I had to add a few lines to php5.ini).

As I said, the problem only appears when I'm logged in.  When I'm not logged in, the site works fine.  I'm new to Moodle so I don't know what things change, in terms of the program, when a user logs in, but I was hoping that someone here would recognize this as a known problem.

Thanks

 

In reply to Frank Chmely

Re: poor performance for logged in users

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Frank

You wrote:
> I have read the Performance pages in the Moodle documentation.

The intro at https://moodle.org/mod/forum/view.php?id=596 has a bit more.

> It's not a question of the server being overworked, as the problem appears when I'm the only one accessing the site.

Just to eliminate the obvious: Are you the 'admin'? Then read https://moodle.org/mod/forum/discuss.php?d=222025#p967483.

> (I also spoke to the hosting company, and they don't see any problems.)

On what evidence?

> It doesn't seem to be a database problem either, as the database test page (which runs some thousands of queries) doesn't take much longer than any other page.

admin/dbperformance.php?

> PHP seems to be configured correctly, in accordance with the docs (I had to add a few lines to php5.ini).

Not very informative. Let's assume that PHP is OK.

> As I said, the problem only appears when I'm logged in. When I'm not logged in, the site works fine.

See above.

> I'm new to Moodle so I don't know what things change, in terms of the program, when a user logs in, but I was hoping that someone here would recognize this as a known problem.

The general pattern is that the cause is the limited resources of a shared hosting service. 'fcourse you need some sort of a proof. The usual candidates are:
- http://docs.moodle.org/en/Debugging
- http://docs.moodle.org/en/Performance_recommendations#Obtain_a_baseline_benchmark
- https://moodle.org/mod/forum/discuss.php?d=192162
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: poor performance for logged in users

by Frank Chmely -

Hi, Visvanath --

I am logging in as an admin.  That's interesting.  I'm curious to know why there's such a big difference depending on one's role.

Re: the hosting company, they just said that the machine did not seem to be overtaxed, that no other domains were hogging resources, . . .

No, the DB test I ran was admin/tool/unittest/dbtest.php
(there is no such file admin/dbperformance.php in my 2.2.7+ installation)

Re: PHP settings, I added:

session.bug_compat_warn = 0
magic_quotes_gpc = 0
memory_limit = 128M

since the server's default values for these differed from what the docs said were required or recommended.

Based on another forum post, tonight I also changed some of the cache settings:

apc.max_file_size = 10M
apc.shm_size = 256M
apc.stat = 0

which seems to have sped things up a little.  (Although I wonder about the cache size; it might larger than necessary.  The default was 30M, which seems to be too small for Moodle 2.2, but in an hour of testing I didn't see more than about 50M cached.)

I'll check the links you've provided tomorrow (it's almost 1:00 AM, here, now).

Thank you,
Frank

In reply to Frank Chmely

Re: poor performance for logged in users

by Ashley Holman -

Hi Frank,

- What third party plugins, or code customisations, if any, do you have installed?

- Can you try switching on the "Use database for session information" option and seeing whether it makes any difference?  Note that when you change this option, all logged in users will be logged out and required to re-login.

Cheers

Ash

In reply to Ashley Holman

Re: poor performance for logged in users

by Frank Chmely -

Hi,

No third-party plugins or custom code, just Moodle 2.2.7+ fresh out of the box.

I'm reluctant to try that option, since almost everything I've read says that it will be slower except on the largest sites.  (Ours has currently got some tens of users, not all of whom log in at once.)  But I can give it a try late tonight, when it won't interfere with others' work.

The icon by your post says you're part of the Core developers group.  Maybe you can explain why pages take so much longer to load for someone who's logged in as an admin?  (see the link in V's reply, above)  That is, what extra work is Moodle doing just because I'm logged in as an admin?  Or maybe you could point me to the relevant section of the documentation?

Thanks,
Frank

In reply to Frank Chmely

Re: poor performance for logged in users

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Admins get many, many more options in the Settings block. Preparing that list of settings is what takes most of the time.

In reply to Frank Chmely

Re: poor performance for logged in users

by Ashley Holman -

DB sessions will help if you have very slow write speeds to your webserver's moodledata directory.  It's worth checking to see if it makes a difference.

Also, turn on the "performance info" option which will output performance debugging info in the page footer.  Check that to see whether the page is actually taking 15s to generate.  If it says its only taking 3s then you either have a bottleneck elsewhere, or it could even be client-side lag.

If it's genuinely taking 15s to generate then get the xhprof extension installed and turn on profiling.  This will show where all the time is being spent in which parts of the code.

In reply to Ashley Holman

Re: poor performance for logged in users

by Ashley Holman -

Actually I could probably be a bit more helpful by giving you a link to information about setting up xhprof: http://docs.moodle.org/dev/Setting_up_xhprof_on_Moodle

 

If you can manage that, then show us a report of one of your slow pages (ordered by "Excl. Wall Time" descending).  Probably a few different profiles of front page, course page, etc would be good.

Average of ratings: Useful (1)
In reply to Ashley Holman

xhprof on Moodle

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
In reply to Frank Chmely

Re: poor performance for logged in users

by J S -

Hello

It looks like your version of mysql is a bit old.  One option would be to upgrade to a later version which will include performance enhancements.  Try to get to mysql 5.5 if possible.