Unbarebly slow

Unbarebly slow

per Kevin Bayer,
Number of replies: 11

I'm running 2.0 on a Windows IIS server with the latest PHP version and a recent mysql version.  We access Moodle using IE8 (I know I know).

I only have about 40 users, with maybe 7 online at a time. Moodle is so slow, even when I'm the only person logged in. Page loads take literally seconds at times. It seems marginally faster with Firefox, but still ridiculously slow. 

Suggestions?

Yes, I've followed most of the steps under Performance, but some of the items listed to edit in the Windows registry don't exist at all on my machine.

 

Average of ratings: -
In reply to Kevin Bayer

Re: Unbarebly slow

per Howard Miller,
Avatar Core developers Avatar Documentation writers Avatar Particularly helpful Moodlers Avatar Peer reviewers Avatar Plugin developers
Best suggestion... run Linux not Windows.

However, failing that, you need to monitor your system. I don't know anything about Windows servers but there'll almost certainly be monitoring software available. The one you want is the type that produces lots of nice graphs of all the vital parameters of the system. You can then see what's running out of resource when Moodle slows down.

Depending on the spec of your system and what the users are doing I've seen similar problems to yours before. You need beefy hardware to run Moodle on Windows.
In reply to Howard Miller

Re: Unbarebly slow

per Rafiq Muhammad,

Well, the issue is not as simple as switching from windows to linux. There are many instances where the system can run slow, or rather under perform.

I have an experience using 32 bit Apache on a 64bits Itanium (Windwos 2008) which performed poorly. It can't even serve our college user under low load period.

After long investigation, I noticed that the Apache process in the 64bit itanium consumed 10 time the memory of the same apache process in a 32bit system. I am suspecting that the OS is putting some wrapper arond the 32 bit apache, which indirectly make it slow.

So I switched to IIS 7. What I got is an instance result of improvement of my server and moodle off course. The server alone can now serve our college even during peak period.

In reply to Rafiq Muhammad

Re: Unbarebly slow

per Visvanath Ratnaweera,
Avatar Particularly helpful Moodlers Avatar Translators
Hi Rafiq

> I have an experience using 32 bit Apache on a 64bits Itanium (Windwos 2008) which performed poorly. It can't even serve our college user under low load period.

Had a similar experience with a USB LaserJet printer connected to a Windows 2008 Server 64x and getting Windows XP (32 bit) clients printing. It was hell, took me days. The explanation: poor programming!
triste

> So I switched to IIS 7.

I installed Debian Squeeze 64 bit inside VMware in the same server. Got Win XP (32 bit), Debian (64 and 32 bit) clients printing within hours. Wrote a two page summary for my trainees, the majority of them repeated the exercise in the 90 min. assigned to the session.
In reply to Visvanath Ratnaweera

Re: Unbarebly slow

per Frank B,

Then maybe cut out the vmware overhead, and run debian natively on it's own server for more performance gains.

In reply to Kevin Bayer

Re: Unbarebly slow

per Frankie Kam,
Avatar Plugin developers

Hi Kevin,

I know the feeling. Introduce and announce a new-fangled Virtual Learning system only to see it grind to a halt. The facilitator beats a hasty retreat to the trenches. I'm here to post a solution for you: use a Php accelerator. If you can, increase your RAM.

I'm using  a VPS running on a measly 512Mb RAM. I had speed problems when 10 students logged in....no even when I myself logged in. Unbearably slow. So I decided to surf the net and look for ways to optimize my Moodle. I have installed eaccelerator for my Linux VPS. I think it works because yesterday my students (around 6 of them) logged in simultaneously and the access speed was BETTER. I don't know about Moodle under Windows, but you might want to check out some free PhP Accelerators available on the Net. I believe even moodle.org uses one of these beasts.

For my site (http://scm.moodleace.com) I used these websites:
http://aldenzi.blogspot.com/2008/07/install-eaccelerator-on-centos-52.html
-and-
http://www.techiecorner.com/111/install-eaccelerator-optimize-php-performance-reduce-server-load
-and-
http://www.dedicated-resources.com/guide/128/eAccelerator-for-PHP.html

Hope this helps.
Frankie Kam, Melaka, Malaysia.

In reply to Kevin Bayer

Re: Unbarebly slow

per Frankie Kam,
Avatar Plugin developers

Hi Kevin

Another thing you will WANT to do for your Moodle site is to enable mod_gzip on your server. What this means is the your php, HTML and CSS pages will be compressed before being sent to the user's browser. This reduces the file size of the transfer, which also reduces the connection time between your Moodle server and the client's browser. So it should translate into faster page loads!

I've implemented on-the-fly compression for my Moodle site's PHP files. It doesn't work yet with CSS or HTML files. Check out the attached screenshot.

See: http://www.whatsmyip.org/http_compression/phpgzip/

http://phplens.com/phpeverywhere/tuning-apache-php

http://www.jhuskisson.com/articles/adding-gzip-compression-to-your-site-via-htaccess

http://www.phpbuilder.com/columns/piergiorgio20010321.php3?print_mode=1

Check if your website is gzip-enabled:
http://www.whatsmyip.org/http_compression

Attachment gzip_MoodleAce2.jpg
In reply to Frankie Kam

Re: Unbarebly slow

per Frankie Kam,
Avatar Plugin developers

Correction!!!

Enabling mod_gzip worked fine EXCEPT that on my Linux Moodle site (http://scm.moodleace.com), my images got gzipped. This resulted in the images on my Moodle site not being displayed in their image-holders! Urgh!!

So I disabled the compression of mod_gzip by removing this line from my php.ini: output_handler = ob_gzhandler

The GOOD NEWS is that I discovered the wonder of mod_deflate instead. My Centos VPS comes installed with mod_deflate. Refer to this website to see how it is implemented:
http://articles.sitepoint.com/article/mod_deflate-apache-2-0-x
-and-
http://www.electrictoolbox.com/compress-files-apache-mod-deflate
-and-
http://moodle.org/mod/forum/discuss.php?d=87024

Basically, you want to enable on-the-fly compression for these file types: php, html, text files, css, javascript. You also want to disable on-the-fly compression for these file types: pdf, images, zip, tar, tgz, any compression file, mp3, etc.

To test your Linux/Centos server to see whether it comes installed with mod_deflate, type:
# httpd -M

After modifying your /etc/httpd/conf/httpd.conf file, you need to:

1. Reload your Apache by typing in Linux: /etc/init.d/httpd reload

2. Check out your website to see if the mod_deflate is working by surfing to: http://www.whatsmyip.org/http_compression (don't you just love this site?).

It should be WORKING!
Hope this helps! clinhada

Frankie Kam, Melaka, Malaysia

APPENDIX
======

Here's the bottom part of my httpd.conf file:

#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
...(a few hundred lines here)...
<Location />
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/x-httpd-php application/x-javascript text/css
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|mp3|bz2|sit|rar)$ no-gzip dont-vary
</Location>

Now Kevin, all you need to do is to figure out how to do this in the Windows environment. I'm using Linux Centos, so perhaps some kind sould in this lovely moodle.org community can help you in that in the Windows Server 2003/2008 forum! gran sorire

Average of ratings:Useful (2)
In reply to Kevin Bayer

Re: Unbarebly slow

per Mehwish Leghari,

Thanks all. It gave me a lot of knowledge about speed problems.

In reply to Mehwish Leghari

Re: Unbarebly slow

per Frankie Kam,
Avatar Plugin developers

BUT WAIT...THERE'S MORE!!!

To speed up your website, you'll ALSO want to enable Php caching (also known as Php Acceleration).

I only have experience with Eaccelerator and not with the APC. I'm sure many others have nothing but praise for BOTH software in increasing their page loading times.

I setup eaccelerator with these definitive guides. These links have helped me to set up eAccelerator on my 512Mb RAM Linux (Centos 5) Virtual Private Server !!!!!

http://www.theadminzone.com/forums/showthread.php?t=8152
-and-
http://eaccelerator.net/wiki/InstallFromSource
-and-
http://www.php.ph/2007/12/21/centos-5-eaccelerator-installation/
-and-
http://moodle.org/mod/forum/discuss.php?d=164199

But following the instructions, I discovered that that my pages still wouldn't cache. See my plight in http://moodle.org/mod/forum/discuss.php?d=166284

So in desperation, I contacted my Web Host and they gave me some clues. I then surfed somewhere where the webpage mentioned that "eAccelerator only works with mod_php or php in fastcgi mode. It can't be used in cgi or cli because eAccelerator needs to set up shared memory, and this can only be done when all php instances that need to access it are forks of the first process."

Aha! The game's afoot! So with guidance from my web host, I setup my Plesk Panel so that php would run not as cgi, but rather as fast-cgi!!! THEN to my amazement and wonder, my pages actually started to cache. Not just a few cached pages, but hundreds of cached pages just by clicking around a few times around my Moodle site. Hallelujah!!!

See the attached images to see the caching of my php code working as it should.

 

Another screen capture, this time accessible from within my Moodle main page (Admin
settings). I.e., "Site Administrations | Server | PHP info". Scroll down through all the Php
info until you come to the eAccelerator section. Notice it says 621 pages are cached?
Well PHP code is being compiled and store in shared memory. Each time the same page
is requested by a web browser, my Virtual Private Server (VPS) will sent the already compiled
code from shared memory, thus saving time. So a person surfing my Moodle site will
experience faster page loads!!!

I have allocated 64Megs of RAM for the Php caching. As you might know, this amount
of RAM will quickly be filled up with cached PHP compiled code. So the more RAM my VPS has,
the better the surfing experience will be.

Why am I over the moon with Webpage compression with mod_deflate and Php Acceleration of my Moodle site? Simple! My VPS is running on a measly 512Mb RAM!!! Some of you  guys have a Moodle server running on 4 Gigs of RAM!!! And my server's (VPS's) download pipe is trickling in at 512Kbs best effort. Some of you are enjoying 10Mbs or 100Mbs speeds for your servers, you 'lucky' ones you. So now you know why I am so happy to have speeded up my Moodle site the way I have shared with you. clinhada

If you found my tips on mod_deflate and eAccelerate useful, would you squeeze me a couple of Gigs of RAM through your modem and send the RAM to my modem please, pretty please? Or better still donate a certain amount to me every month so that I can upgrade my VPSs specs. Just kidding.

Frankie Kam
IT Lecturer
"To God Be The Glory Great Things He Hath Done"

Average of ratings:Useful (2)