Moodle 3.4 performance is very Low

Moodle 3.4 performance is very Low

by Daoud El Gharib -
Number of replies: 20

Greetings,


I have installation of Moodle 3.4, I`m using VPS hosting  with 4 cpu and Memory 8 GB. My site performed good for 2 Months, and today the performance is very low.


The home page is openning in good performance, but when I tried to login it takes some time, and when I tried to check the plugin overview, it gives 504 error.


Please support! Case very sensitive!!

Average of ratings: -
In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

Please see/read:

https://www.lifewire.com/504-gateway-timeout-error-explained-2622941

NOT suggesting making any changes you might see on the page linked above, but it will give you an idea of what things need to be checked ... it might not be the server, BTW.   So let's not panic and start changing things without really knowing.

On the server, check web services error logs.  They should reveal some useful information.

Do check with your provider ... they might be experiencing some issues.

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.4 performance is very Low

by Daoud El Gharib -

Thanks Ken for your respond,


I have checked with the host provider about the server performance, and they ensured that the server is performing well. Additionally, I have a wordpress site hosted on the same server, and it is performing excellent.


BTW, not all pages gives 504 error, some pages works just fine, some others show pop up dialog with message "undefined".

some pages that gives 504 such as Plugins, debugging, ....

Some pages gives undefined pop up dialog such as: course pages


Please support!

In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

Seen an another of your postings ... 'we need to reset this site to its original state each day at 7:30 am'.   Are you still doing that?

504 is *NOT* a moodle error ... it is an Apache error.   Thus the reason you were asked to check your server's apache error logs.   Did you?

Did you also read the reference link provided?

Wordpress might actually be the cause, but don't remove WP.

'undefined' popups ... have Tours turned on?   Turn off for now.

Do you have Theme Developer turned on in Moodle?

Your server provider isn't helping ... or you asked the wrong questions of them.   Forget the word 'performance' for now ... talk with them about the same things you are posting here .... 504 errors.

Are you using a tablet or a browser from a computer?

Have you tried turning on FireFox's Tools, WebDeveloper, network to see what might be going on.

If you cannot turn on debugging via browser, do you have other access to be able to edit the config.php file and insert lines from config-dist.php (Section 7, I think) that turn on debugging from the config file.

'spirt of sharing', Ken




In reply to Ken Task

Re: Moodle 3.4 performance is very Low

by Daoud El Gharib -
Hello,


Thanks for your response, I will try to answer your questions one by one:

  1. Resetting my site was made to a totally different site  and it was stopped from long time...so it is not related in any way to this site.
  2. I did not check the Apache Log, and I did not find this log, and the hosting provider is not helping much on this matter
  3. I checked your reference link... However I`m getting the 504 error only when trying to login, and before logging in to the site the home page and its links is working fine. Moreover, I faced this error only on some specific pages and not on whole site
  4. How I know if Tours turned on or off  and Theme Developer turned on if I cannot reach theses settings, can you help me with another workaround
  5. I`m using browser in computer, and tried it from my iphone, the same issue persist
  6. I have full access to my hosting, but what exactly I should add to config.php from config-dist.php

Please help!

In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

Responses;

1. have no idea what you mean ... you've clone it? and you are looking at the clone?

2. if this is a VPS, one of trhe deals with VPS (un-managed) is that you basically have declared you know what you are doing when selecting the package.   Suggest you share what the operating system is .... just don't say linux ... say things like Ubuntu, CentOS, Debian, etc.   Most, I think, would have a /var/log/ directory and in there one might find a httpd (redhat family) or apache2 (debian/Ubuntu family) directory where there are logs.   The are text/ascii.

3. only on some links ... 504's are a break in communications between your browser and the server and they could be be pretty consistent ... meaning, front page displays (alot of that coming from cache), BUT links to other things don't.

4. try going direct:

Debugging
https://yoursite/admin/settings.php?section=debugging

User Tours
https://yoursite/admin/tool/usertours/configure.php

If you have other sites that are a 3.4 you can discover those direct links by logging in at other site, finding the area, and copying the URL to another browser instance pointed at your troubled box.

From config-dist.php ... Section 7 right where I remembered it was:

//=========================================================================
// 7. SETTINGS FOR DEVELOPMENT SERVERS - not intended for production use!!!
//=========================================================================
//     
// Force a debugging mode regardless the settings in the site administration
// @error_reporting(E_ALL | E_STRICT); // NOT FOR PRODUCTION SERVERS!
// @ini_set('display_errors', '1');    // NOT FOR PRODUCTION SERVERS!
// $CFG->debug = (E_ALL | E_STRICT);   // === DEBUG_DEVELOPER - NOT FOR PRODUCT$
// $CFG->debugdisplay = 1;             // NOT FOR PRODUCTION SERVERS!

So we didn't look very hard. :\

When pasting into config.php file, just the last 4 lines of the clip above ... and, of course, you have to un-comment them by taking out the // in front of them to make them active.    Do reverse when wanting to take site out of debugging

6. then you will be using ssh shell then.

uname -an

For exploring logs ....

cd /var/log/

ls

see an apache2?

cd apache2

ls

see an error.log?

tail error.log

see a httpd?

cd httpd

ls

see an error_log?

tail error_log

might be ssl

tail ssl_error_log

Have you tried turning on Tools WebDevloper  network to see what it might able to report

Ken



In reply to Ken Task

Re: Moodle 3.4 performance is very Low

by Daoud El Gharib -

Hello,

1) no it is not cloning..We have a new Moodle site 

2) Linux server.sorce.online 2.6.32-696.28.1.el6.x86_64 #1 SMP Wed May 9 23:09:02 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

4) Debugging: https://yoursite/admin/settings.php?section=debugging...this is not accessible (504)

User Tours: https://yoursite/admin/tool/usertours/configure.php.. We disable this

6) Appache2: error_log:

root@server.sorce.online [apache2]# tail error_log

[Sun May 20 01:39:23.957257 2018] [core:error] [pid 9748:tid 140244659685120] [client 194.126.21.8:49314] Script timed out before returning headers: view.php, referer: http://learnit.sorce.online/my/

[Sun May 20 01:39:23.957585 2018] [core:error] [pid 9696:tid 140244617725696] [client 194.126.21.8:50750] Script timed out before returning headers: view.php, referer: http://learnit.sorce.online/my/

[Sun May 20 01:41:44.112190 2018] [core:error] [pid 10975:tid 140244775073536] [client 194.126.21.8:61363] Script timed out before returning headers: view.php, referer: http://learnit.sorce.online/my/

[Sun May 20 01:42:13.320488 2018] [core:error] [pid 9748:tid 140244691154688] [client 194.126.21.8:52567] Script timed out before returning headers: view.php

[Sun May 20 01:44:44.050281 2018] [core:error] [pid 10533:tid 140244670174976] [client 194.126.21.8:57856] Script timed out before returning headers: view.php, referer: http://learnit.sorce.online/my/

[Sun May 20 02:51:22.838668 2018] [:error] [pid 10975:tid 140244554786560] [client 185.234.217.222:51114] File does not exist: /home/sorceonl/public_html/wp-login.php, referer: http://sorce.online/wp-login.php

[Sun May 20 02:51:22.984059 2018] [:error] [pid 10975:tid 140244554786560] [client 185.234.217.222:51114] File does not exist: /home/sorceonl/public_html/wp-login.php, referer: http://sorce.online/wp-login.php

[Sun May 20 03:05:25.249898 2018] [mpm_worker:notice] [pid 11670:tid 140245120661472] AH00297: SIGUSR1 received.  Doing graceful restart

[Sun May 20 03:05:25.365421 2018] [mpm_worker:notice] [pid 11670:tid 140245120661472] AH00292: Apache/2.4.33 (cPanel) OpenSSL/1.0.2o mod_bwlimited/1.4 configured -- resuming normal operations

[Sun May 20 03:05:25.365447 2018] [core:notice] [pid 11670:tid 140245120661472] AH00094: Command line: '/usr/sbin/httpd'


Tools WebDevloper and network is not giving much information


Please Help!


In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

From SA, Tx, i can see your site just fine ... no 504/timeouts of any kind.

Did run web tools .... no issues.

Your server is 16 hops away from my location ... that's pretty good considering where it's hosted - IMHO

Try this from your workstation:

traceroute toIPaddressofServer

Your workstations IP address shows to be from LB.  The traceroute command will show how many hops you are away from your own server.

What do constant pings from your workstation to the server IP address look like?

Constant ping from my location to your server ... dropped no packets and response times acceptable range (mostly in mid to high 30's .... that's miliseconds).

Can you go to another connection to the net .... and use another computer ... and try your site?

On your workstation ... flush the DNS cache (Google for how to do that).   Then do a dig or DNS lookup for your server.   Right IP returned?  

Doesn't appear to be a Moodle issue ... maybe not even server ... but workstation and connectivity to the internet and to your server.

'spirit of sharing', Ken




In reply to Ken Task

Re: Moodle 3.4 performance is very Low

by Daoud El Gharib -

Thanks Ken for your responses..Appreciated,


1) May I give you a trial  username and password to check it from your location, since the issue is happening on the Login.


2) Tracert shows 30 hops and the following lines:

  1     5 ms     5 ms     3 ms  mobilewifi.home [192.168.1.1]

  2     *        *        *     Request timed out.

  3    76 ms    69 ms    69 ms  10.100.186.34

  4     *        *        *     Request timed out.

  5     *        *        *     Request timed out.

  6     *        *        *     Request timed out.

  7     *        *        *     Request timed out.

  8     *        *        *     Request timed out.

  9     *        *        *     Request timed out.

 10     *        *        *     Request timed out.

 11     *        *        *     Request timed out.

 12     *        *        *     Request timed out.

 13     *        *        *     Request timed out.

 14     *        *        *     Request timed out.

 15     *        *        *     Request timed out.

 16     *        *        *     Request timed out.

 17     *        *        *     Request timed out.

 18   224 ms   229 ms   399 ms  testlearnit.sorce.online [50.116.103.126]


3) I have tried from different devices and different networks in Lebanon and Dubai. From Dubai more pages opened but still some other pages generating 504 issue


4) Constant ping to server gives response time average 200ms 


5)we have 3 sites in the hosting account (Prod: Moodle, Test: Moodle, and Prod: Wordpress), the Wordpress is working just fine, while both Prod and Test Moodle sites generated the issue at the same time. Wiered and inconsistent Error!!!!


6)Is their any relation between this issue and the ".htaccess" file?


7) what you mean by Right IP returned?


8) I have 3 Plugins: MyLiveChat, Course Dedication, and Site is connected with Google Analytics. I disconnect from Google Analytics but nothing improved. and since I am not able to check the plugins, so I could not disable the others that are suspected. Is there a way to disable this from the files or database directly?


Please help!! 


In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

Not sure an account on your server will help ... but PM me if you like ... can't do anything in moodle to correct network issues.

On my traceroute to learnit completed.   Last hop below:

16  server.kutaukufaku.com (50.116.103.126)  35.292 ms  39.040 ms  38.661 ms
Your traceorute also ended at 50.116.103.126
which isn't the IP of your server.

could that be the source (the gateway) of these errors?   Appears to be a gateway to your server.

MyLiveChat, Course Dedication

MyLiveChat
https://moodle.org/plugins/pluginversions.php?plugin=block_mylivechat
shows a version compat up to 2.5.

But there is a version supposdly compat with 3.x
https://mylivechat.com/addons/moodle-live-chat-3.x.aspx

The other I'll let you do.

After you get this figured out, probably need to look at updating MyLiveChat if you are running the old version.

Also an observation on test server.  You did not run search and replace to replace the FQDN of the test server.  IF it is a clone of production, it has everything.   Link to 'Previews' actually go to descriptions/notes but the link that say "Enter Preview Course" actually go to the production server.

'spirit of sharing', Ken


In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

As stated in previous  response, your bad gateway errors is directly related to DNS.

In the traceroute you provided can see it was done from a home network (mobilewifi.home)

With credentials provided me to your site, experienced NO errors.

Suggest this was really an issue with DNS on whatever machine you were using.

DNS is still messed up ...

The reverse lookups:

126.103.116.50.in-addr.arpa. 14400 IN    PTR    server.sorce.online.
126.103.116.50.in-addr.arpa. 14400 IN    PTR    server.kutaukufaku.com.
126.103.116.50.in-addr.arpa. 14400 IN    PTR    thedailyhoney.com.

still point to 3 domains.

Using Google's 8.8.8.8 dns resolver

server.kutaukufaku.com.    59    IN    A    74.220.199.6

thedailyhoney.com.    3599    IN    A    50.87.144.190

Neither of those IP's are on the same network ... and definetly NOT where your server is hosted - and definetly not the FQDN as provided by your own DNS server ns1.sorce.online whose records were changed just today:

sorce.online.        300    IN    SOA    ns1.sorce.online. root.server.sorce.online. 2018052100 3600 7200 1209600 300

The 2018052100 above is a date ... may 21.

Suggest you do this at home .... that wifihome network.   edit your host file and make two entries  like the following

50.116.103.126 learnit.sorce.online learnit

50.116.103.126 testlearnit.sorce.online testlearnit

Why do that?   Every computer on the internet has to use DNS.  Any computer, regardless of operating system will check the local computers host file for references *before* using DNS.   With the above entries in your computer at home, there will be no more confusion as far as your workstation/home computer is concerned.

The mess with DNS, however, is something you'll have to get assistance with provider.

Even with ns1.sorce.online being the "authority' server for sorce.online, other DNS servers could come into play with other users ... ie, your students attempting to access your server.

DNS still resolves, in-correctly, the follwing:

;; ANSWER SECTION:
126.103.116.50.in-addr.arpa. 14400 IN    PTR    server.sorce.online.
126.103.116.50.in-addr.arpa. 14400 IN    PTR    server.kutaukufaku.com.
126.103.116.50.in-addr.arpa. 14400 IN    PTR    thedailyhoney.com.

Using Google's DNS resolver 8.8.8.8 this is shown for the second and third TLD's shown above:

server.kutaukufaku.com.    59    IN    A    74.220.199.6 - is Bluehost ... OrgTechPhone:  +1-888-401-4678


thedailyhoney.com.    3599    IN    A    50.87.144.190 - is also Bluehost ... same number.

Bluehost needs to investigate why:

126.103.116.50.in-addr.arpa. 14400 IN    PTR    server.kutaukufaku.com.
126.103.116.50.in-addr.arpa. 14400 IN    PTR    thedailyhoney.com.

So all in all ... this is not a moodle issue - but a networking/DNS issue.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

If you have VPS hosting (which I assume is to mean dedicated to just one customer), why does a dig -x on the IP show two more domains?

dig -x 50.116.103.126

;; ANSWER SECTION:
126.103.116.50.in-addr.arpa. 14400 IN    PTR    thedailyhoney.com.
126.103.116.50.in-addr.arpa. 14400 IN    PTR    server.sorce.online.
126.103.116.50.in-addr.arpa. 14400 IN    PTR    server.kutaukufaku.com.

One of the things mentioned with trouble shooting bad gateway errors is DNS.

I would expect to see the above in DNS *IF* the domain was on a 'shared host' ... but not a dedicated VPS.

'spirit of sharing', Ken

In reply to Ken Task

Re: Moodle 3.4 performance is very Low

by Daoud El Gharib -

The VPS is a shared server in bluehost, this is what I understand from the below section:

Virtual Private Server hosting, aka VPS hosting, is a website hosting environment that allows for resources such as RAM and CPU to be dedicated to your account. This is achieved by virtualizing a Dedicated server and splitting the resources amongst the users on that server.


In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

Last I heard .... there's VPS managed and VPS un-managed.  Managed you do the work.  Un-managed they do the work.  But it's not a shared IP address.  Bluehost might define things differently ... and they certainly offer more than one package.

I did qualify responses by saying *IF* your server was dedicated to just you ... single customer ... that NO other domains/services would be coming from NOR referenced in DNS to the IP address other than those that you, the server admin, setup.

I did login to the server in question ... after getting credentials that were student level.   That, of course, would not allow access to anything 'admin' so couldn't test to see if I also got 'bad gateway' errors.   Did see what I hope was a very special drop down that allowed what appeared to be event logs for the course I was in.

Of course, am not going to stay on a site for days to see if I can get a bad gateway error ... at least not for free ... am a nice guy and help folks out on weekends ... but not that nice!



In reply to Ken Task

Re: Moodle 3.4 performance is very Low

by Ken Task -
Picture of Particularly helpful Moodlers

Correction to posting made in haste ...

managed - they do the heavy lifting

un-managed - you do the heavy lifting

Big hosting enterprises, like Bluehost, are not infoulable. I still don't understand *IF* OP has a dedicated VPS why the reverse look ups for two other domains not owed/registered by OP show as pointing to the IP address of OP's server.

It's a hickup like that that could cause or be a factor in 'bad gateway' from time to time.  Once a Windows machine behind a old DLink router locks onto in-correct DNS/IP info ... bad gatway's.   Don't think OP thought to flush DNS cache or even check DNS.   Do know if OP uses the host file trick DNS is taken out of the loop for that site.

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.4 performance is very Low

by Daoud El Gharib -

Appreciate your support,

Thanks for the time you spent trying to provide a solution to our case.


We opened more than 15 support chats and tickets with bluehost support trying to find the cause of the slowness, and they always confirmed that this is related to our site and not to their Serveror Network configuration. 

We have optimized our Moodle through removing some of the plugins, and checking the image sizes, BUT this did not help.


So we are on an open ended case and we started facing comments regarding performance from our clients.  We are now preparing different hosting and planning to migrate our domain (nameservers) to it and then we check the performance. At this point, it will be clearly visible if it is related to DNS and Server OR related to our Moodle site.


Thanks again for your support!

In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

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

Any progress in this? This is a common szenario everybody is interested in.
In reply to Daoud El Gharib

Re: Moodle 3.4 performance is very Low

by Ella Anderson -

There are many HTTP status codes sends to the users and one of them is 504 gateway timeout error and this error occurs when your request is unable to complete by servers. When you visit any site then the site grants your request and sends it to web servers and if your request is unable to complete then the server sends back the error to you.

To know that what is 504 gateway timeout and what does 504 gateway timeout mean then you need to read this content.

504 gateway timeout error is a server-side error and this error occurs when the servers are not able to complete a request due to miscommunication between the servers.

https://www.cuesinfo.com/blog/504-gateway-timeout-error/