-

Note: You are currently viewing documentation for Moodle 3.10. Up-to-date documentation for the latest stable version of Moodle may be available here: Performance FAQ.

Performance FAQ: Difference between revisions

From MoodleDocs
No edit summary
 
(44 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{stub}}
{{Performance}}
==How do you define "concurrent users"?==
As has been repeatedly stressed in the [http://moodle.org/mod/forum/view.php?f=94 Hardware and performance] forum, the load on the server at a particular time depends on the number of concurrent users. Not on the total number of user accounts and not on the number of users logged-in. The term "concurrent users" is used to mean those users for whom the server is actively doing something . It may by processing a webpage written in PHP, querying the database or simply transferring a file. (see also Wikipedia [http://en.wikipedia.org/wiki/Concurrency_(computer_science) Concurrency]). Strictly speaking we mean the number of active web server processes (each of which consume memory) and also the number of database connections.


===How do you define "concurrent users"?===
=== Why is "concurrent users" not a useful metric? ===
As has been repeatedly stressed in the forum [0], the load on the server depends primarily on the number of concurrent users, not on the total number of users neither the number of users logged-in at a given time. In this context, the concurrent users are those for whom the server actively doing something [1]. It may by processing a webpage written in PHP, processing a database querry or simply transfering a file.


When considering a new site or new hardware, this metric is not very useful because you have no idea how many 'concurrent users' (a better term might be 'concurrent requests') you will have.


[0] Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance forum]
For example, if you have 10,000 registered users and you estimate that, during times of peak load, about 1,000 of those users will be using the system, there is no easy way to obtain the number of 'concurrent users'.


[1] http://en.wikipedia.org/wiki/Concurrency_(computer_science)
* It depends on what the users are doing (if they are contributing to a forum they will make fairly frequent requests but with long pauses to write posts; if they are downloading a PDF they will only make a single request but it will take a long time; if they are doing a quiz they will make very frequent requests).


===How do I benchmark a Moodle-site?===
* It also depends on system performance. If your system can serve a typical page in 0.1 seconds then if you have 10 people making a request within a second this is an average of 1 concurrent user. If your system takes 1 second to serve a page then the same usage pattern results in an average of 10 concurrent users.
You can ofcourse benchmark each component of the software stack, starting from the operating system upto the database https://docs.moodle.org/en/Performance#Obtain_a_baseline_benchmark . But there is no easy formula to deduct the maximum number of concurrent users from those data.


There is a PHP-script [2] circulating amoung the Moodle-community which calculates a ballpark figure. Take the current version from 1. March 2007 posted here [3]. Please note running this script on a production server may have side-effects, you are strongly adviced to run it on a test-site.
In addition, the number of concurrent users is not a very accurate measure of demand because a "concurrent user" may be downloading a large file, which takes time to transfer based on the speed of their network connection. While this does place a demand on the server, a server may well be able to cope easily with sending out 10 large PDF files to 10 concurrent users with slow network connections, whereas it might struggle if 10 users were continuously making separate PHP requests to a complex page such as quiz.


[2] http://moodle.org/mod/forum/discuss.php?d=57028
=== What would be a better metric? ===


[3] http://moodle.org/mod/forum/discuss.php?d=57028#p296907
Peak requests per second (either from web logs, mdl_log lines, or similar) is probably a better way to roughly estimate demand on the server - but it is still very difficult to work this out for a new server with unknown usage patterns.


===What are PHP-accelerators?===
==What hardware should I buy for 'n' concurrent users?==
For the definition see Wikipedia [4]. Read the Performance documentation [5] for possible software.
Firstly see above to make sure you express 'n' somewhere near correctly. Unfortunately, the answer is "it depends". It will depend primarily on your chosen operating system, your software configuration (especially web server and database tuning) and what the users will be doing. The worst possible scenario is a large class all starting a timed quiz at exactly the same time. Luckily, users sat reading stuff are not generating any server load at all (until they click for the next activity/page). Very roughly, worst case, your Moodle site may only handle as few as 10-20 concurrent users per GB of memory. Moodle is a large application and can easily use more that 50MB (sometimes a lot more) of RAM per process. If you are planning a very large site, you are strongly encouraged to run a pilot first and take some measurements or resources used.


[4] http://en.wikipedia.org/wiki/PHP_accelerator
Prospective Moodle users tend to vastly over-estimate the required concurrency. It's potentially a very expensive mistake if you get this wrong.


[5] https://docs.moodle.org/en/Performance#PHP_performance
==What is the easiest way to increase performance?==
Buy more memory!


===How do I cluster Moodle?===
==How do I benchmark a Moodle-site?==
You can of course benchmark parts of the system separately: the hardware as seen by the operating system (eg. CPU, disk access), web server performance, database server performance, execution on PHP operations, etc. For further details see [[Performance_recommendations#Obtain_a_baseline_benchmark]].


http://moodle.org/mod/forum/discuss.php?d=57202
But there is no easy formula to deduce the maximum number of concurrent users from those results. There is a PHP-script, the [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script], circulating amoung the Moodle-community which calculates a ballpark figure. The current version is attached to [http://moodle.org/mod/forum/discuss.php?d=57028&parent=772267|the posting on 25. March 2011].


===How do I replicate Moodle?===
Warning: Note that running this script on a production server may have unwanted side-effects. You are strongly adviced to run it on a test-site.


===How do I setup multiple Moodle instances on one server?===
==What are PHP-accelerators?==
http://moodle.org/mod/forum/discuss.php?d=120757
See Wikipedia [http://en.wikipedia.org/wiki/PHP_accelerator PHP accelerator].


===My site is very slow, what should I do?===
Available software are documented under [[Performance_recommendations#PHP_performance]].
 
You find some user suggestions here [http://moodle.org/mod/forum/discuss.php?d=168965 Update on PHP-accelerators].
 
==How do I cluster Moodle?==
 
See [[Performance_recommendations#Scalability]]
 
==How do I replicate Moodle?==
 
[[Mirroring_Moodle]]
 
[http://moodle.org/mod/forum/discuss.php?d=173408&parent=760514  How to Replicate MOODLE ??!!]
 
==My site is very slow, what should I do?==


First find out "how slow". (The theme-trick here).
First find out "how slow". (The theme-trick here).
Line 44: Line 61:
* bug in Moodle
* bug in Moodle
* corrupted database
* corrupted database
* networking issues (DNS, firewalls, ...)


Or your performance could be "normal" under the given circumstances:
Or your performance could be "normal" under the given circumstances:
* Is it a root-server, dedicated server, virtual (shared) server
* Are you on a dedicated server or a shared (virtual) server?
* How much RAM, processing power do you have?
* How much RAM, processing power do you have?
* What is the software stack you use? (Unix or Windows, Apache or IIS, MySQL, PostgreSQL or SQL-Server, ...?)
* What is the software stack you use? (Unix or Windows, Apache or IIS, MySQL, PostgreSQL or SQL-Server, ...?)
* how many concurrent users slows the system down
* how many concurrent users can you support
* what modules/activities they use? Check [https://docs.moodle.org/en/Performance#Performance_of_different_Moodle_modules Performance of different Moodle modules]
* what modules/activities you use? Check [[Performance_recommendations#Performance of different Moodle modules]]
* is your networt setup property? DNS, firewalls. Also check local firewalls and other local security tools?


[https://docs.moodle.org/en/Performance#Obtain_a_baseline_benchmark Obtain a baseline benchmark] and compare it with the published figures.
[[Performance_recommendations#Obtain a baseline benchmark]] and compare it with the published figures.


http://moodle.org/mod/forum/discuss.php?d=102978
==What are the requirements for N users?==
http://moodle.org/mod/forum/discuss.php?d=103040


===What hardware is needed for N users?===
[http://moodle.org/mod/forum/discuss.php?d=111847 A moodle setup for 10K simultaneous users]
[http://moodle.org/mod/forum/discuss.php?d=111847 A moodle setup for 10K simultaneous users]


===How many users will my installation support?===
==How many users will my installation support?==
 
This is another way of asking the same question as above. Please move up.
 
==What is the best webserver?==
 
It depends who you ask. [[Apache]] is almost universal on Unix and Linux. but [[Nginx]] is out performing latest Apache versions and [https://news.netcraft.com/archives/2017/01/12/january-2017-web-server-survey.html gaining momentum] for the last couple of years. [[IIS]] is native to Windows Server but Apache can be used as well. As always, the latest version available is likely to provide the best performance. There are other "niche" web servers. If you are interested in one of those you are likely to know about it already.
 
Here are some latest [https://www.rootusers.com/web-server-performance-benchmark web servers benchmarks].
 
==Should I go for 64 bit or is 32 bit OK?==
 
Most servers these days will be 64 bit anyway. On desktops - if you have a choice - 32 bit is probably better supported.
 
==What hosting provider do you recommend?==
[https://moodle.com/partners/ Moodle Partners] are approved by Moodle HQ, have extensive Moodle expertise and can provide comprehensive support. However, they are unlikely to be the cheapest solution (although it's worth asking) if your budget is tight. Cheap 'shared hosting' may not provide sufficient resources to run Moodle properly. There are many other options and it really depends on your needs. For one discussion see http://moodle.org/mod/forum/discuss.php?d=99405


===Which operating system is the best?===
== See also ==


===What is the best webserver?===
* [http://tjhunt.blogspot.co.uk/2013/05/performance-testing-moodle.html Performance-testing Moodle blog post] from Tim Hunt


===Should I go for 64 bit or is 32 bit OK?===
Using Moodle forum discussions
* [https://moodle.org/mod/forum/discuss.php?d=227745 Moodle 2.4 performance]
* [http://moodle.org/mod/forum/discuss.php?d=102978 1000 concurrent users]
* [http://moodle.org/mod/forum/discuss.php?d=103040 Tool to estimate server's maximum concurrent users]
* [http://moodle.org/mod/forum/discuss.php?d=144718 Handling Moodle database load - a solution!]
* [http://moodle.org/mod/forum/discuss.php?d=191277 December 2011 Thread on Concurrent Users v2.03]
* [http://moodle.org/mod/forum/discuss.php?d=192162 How do you monitor your Moodle server?]
* [http://moodle.org/mod/forum/search.php?notwords=Re:&id=5&subject=performance All performance related discussions]
* [http://moodle.org/mod/forum/search.php?notwords=Re:&id=5&forumid=33&&subject=performance Performance related discussions in the General Developer forum]
* [https://moodle.org/mod/forum/discuss.php?d=236560 What (hardware/config) made the Teaching with Moodle MOOC course run so well ?] forum thread


===What hosting provider do you recommend?===
[[Category:FAQ]]
http://moodle.org/mod/forum/discuss.php?d=99405


[[Category:FAQ]] I [[Category: Administrator]] I [[Category:Performance]]
[[fr: FAQ de Performances]]
[[es:Desempeño FAQ]]
[[de:Geschwindigkeit FAQ]]

Latest revision as of 11:45, 15 April 2019

How do you define "concurrent users"?

As has been repeatedly stressed in the Hardware and performance forum, the load on the server at a particular time depends on the number of concurrent users. Not on the total number of user accounts and not on the number of users logged-in. The term "concurrent users" is used to mean those users for whom the server is actively doing something . It may by processing a webpage written in PHP, querying the database or simply transferring a file. (see also Wikipedia Concurrency). Strictly speaking we mean the number of active web server processes (each of which consume memory) and also the number of database connections.

Why is "concurrent users" not a useful metric?

When considering a new site or new hardware, this metric is not very useful because you have no idea how many 'concurrent users' (a better term might be 'concurrent requests') you will have.

For example, if you have 10,000 registered users and you estimate that, during times of peak load, about 1,000 of those users will be using the system, there is no easy way to obtain the number of 'concurrent users'.

  • It depends on what the users are doing (if they are contributing to a forum they will make fairly frequent requests but with long pauses to write posts; if they are downloading a PDF they will only make a single request but it will take a long time; if they are doing a quiz they will make very frequent requests).
  • It also depends on system performance. If your system can serve a typical page in 0.1 seconds then if you have 10 people making a request within a second this is an average of 1 concurrent user. If your system takes 1 second to serve a page then the same usage pattern results in an average of 10 concurrent users.

In addition, the number of concurrent users is not a very accurate measure of demand because a "concurrent user" may be downloading a large file, which takes time to transfer based on the speed of their network connection. While this does place a demand on the server, a server may well be able to cope easily with sending out 10 large PDF files to 10 concurrent users with slow network connections, whereas it might struggle if 10 users were continuously making separate PHP requests to a complex page such as quiz.

What would be a better metric?

Peak requests per second (either from web logs, mdl_log lines, or similar) is probably a better way to roughly estimate demand on the server - but it is still very difficult to work this out for a new server with unknown usage patterns.

What hardware should I buy for 'n' concurrent users?

Firstly see above to make sure you express 'n' somewhere near correctly. Unfortunately, the answer is "it depends". It will depend primarily on your chosen operating system, your software configuration (especially web server and database tuning) and what the users will be doing. The worst possible scenario is a large class all starting a timed quiz at exactly the same time. Luckily, users sat reading stuff are not generating any server load at all (until they click for the next activity/page). Very roughly, worst case, your Moodle site may only handle as few as 10-20 concurrent users per GB of memory. Moodle is a large application and can easily use more that 50MB (sometimes a lot more) of RAM per process. If you are planning a very large site, you are strongly encouraged to run a pilot first and take some measurements or resources used.

Prospective Moodle users tend to vastly over-estimate the required concurrency. It's potentially a very expensive mistake if you get this wrong.

What is the easiest way to increase performance?

Buy more memory!

How do I benchmark a Moodle-site?

You can of course benchmark parts of the system separately: the hardware as seen by the operating system (eg. CPU, disk access), web server performance, database server performance, execution on PHP operations, etc. For further details see Performance_recommendations#Obtain_a_baseline_benchmark.

But there is no easy formula to deduce the maximum number of concurrent users from those results. There is a PHP-script, the Performance perspectives - a little script, circulating amoung the Moodle-community which calculates a ballpark figure. The current version is attached to posting on 25. March 2011.

Warning: Note that running this script on a production server may have unwanted side-effects. You are strongly adviced to run it on a test-site.

What are PHP-accelerators?

See Wikipedia PHP accelerator.

Available software are documented under Performance_recommendations#PHP_performance.

You find some user suggestions here Update on PHP-accelerators.

How do I cluster Moodle?

See Performance_recommendations#Scalability

How do I replicate Moodle?

Mirroring_Moodle

How to Replicate MOODLE ??!!

My site is very slow, what should I do?

First find out "how slow". (The theme-trick here).

The next question is, whether the performance is normal or something malfunctions. There are many things which can malfunction:

  • hardware
  • crashed filesystems, specially network filesystems
  • memory leaks or other crashes in the system
  • bug in Moodle
  • corrupted database
  • networking issues (DNS, firewalls, ...)

Or your performance could be "normal" under the given circumstances:

  • Are you on a dedicated server or a shared (virtual) server?
  • How much RAM, processing power do you have?
  • What is the software stack you use? (Unix or Windows, Apache or IIS, MySQL, PostgreSQL or SQL-Server, ...?)
  • how many concurrent users can you support
  • what modules/activities you use? Check Performance_recommendations#Performance of different Moodle modules

Performance_recommendations#Obtain a baseline benchmark and compare it with the published figures.

What are the requirements for N users?

A moodle setup for 10K simultaneous users

How many users will my installation support?

This is another way of asking the same question as above. Please move up.

What is the best webserver?

It depends who you ask. Apache is almost universal on Unix and Linux. but Nginx is out performing latest Apache versions and gaining momentum for the last couple of years. IIS is native to Windows Server but Apache can be used as well. As always, the latest version available is likely to provide the best performance. There are other "niche" web servers. If you are interested in one of those you are likely to know about it already.

Here are some latest web servers benchmarks.

Should I go for 64 bit or is 32 bit OK?

Most servers these days will be 64 bit anyway. On desktops - if you have a choice - 32 bit is probably better supported.

What hosting provider do you recommend?

Moodle Partners are approved by Moodle HQ, have extensive Moodle expertise and can provide comprehensive support. However, they are unlikely to be the cheapest solution (although it's worth asking) if your budget is tight. Cheap 'shared hosting' may not provide sufficient resources to run Moodle properly. There are many other options and it really depends on your needs. For one discussion see http://moodle.org/mod/forum/discuss.php?d=99405

See also

Using Moodle forum discussions