Load Test

Load Test

by Yadika Prasad -
Number of replies: 12

Hello,

with an intention to conduct online exam i have a migrated to a VPS with 4Core, 8GB RAM and 200GB space. ill have approx 250 simultaneous users attempting quizzes for various courses. Is the setup sufficient? Anything that can help it go smoother. I still have my doubts. Would appreciate some suggestions. I m on moodle 3.9+ with ~2000 enrolled users. but at one time there will be ~250 users accessing quizzes. 50-60 user per quiz for 2 hours


Thank You.

smile


Average of ratings: -
In reply to Yadika Prasad

Re: Load Test

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

At first glance your server is insufficient for 250 users accessing a quiz at the same time. According to https://docs.moodle.org/en/Performance_FAQ#What_hardware_should_I_buy_for_.27n.27_concurrent_users.3F you need 1 GB for every 10 to 20 users, which means 8 GB will handle between 80 to 160 concurrent users.

But don't get stuck in this prediction. It is a very rough estimation, there are many other factors which influence the capacity. You need to study the two documents in this forums header carefully.

One observation though: You said "50-60 user per quiz for 2 hours" Does it mean those 250 consist of 4 to 5 classes of 50 to 60 students each doing exams during the same 2 hours? Then it is possible that all those 250 students do not start during the same minute - means those 250 users are not concurrent. See https://docs.moodle.org/en/Performance_FAQ#How_do_you_define_.22concurrent_users.22.3F.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Load Test

by Yadika Prasad -
Thank You for reply sir,
yes there are approx 250 (60 accessing quiz1, another batch quiz2 and so on..) for the same time perios say 8 am to 10 am. I guess i will have to make modifications in the schedule for smoother functioning..
In reply to Yadika Prasad

Re: Load Test

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

If you can reschedule the exam, even 5 min between the batches will reduce number of simultaneous users from 250 to 60 in this case. What you need to know is that during a quiz a client generates a load in the sever only in one of these three events: a) opening the exam b) submitting the exam c) turning pages. When candidates selects or types answers, no requests are sent. See Usman's post.

In practice a) is the limiting factor because depending on the exam situation all the candidates may try to open the exam within the same couple of seconds. In addition to rescheduling with some imagination you can flatten the peak. A standard trick is to set a password for the exam. Make it long but easy to remember. Differences in typing speed and accuracy will flatten the sharpest peak.

Whatever said, many things can go wrong. You have to organize some sort of a rehearsal. Give a practice exam of the same size to a full class and monitor how the server behaves. Polish any rough edges. Detailed instructions on those two and other topics are in the forum documentation mentioned earlier.
In reply to Visvanath Ratnaweera

Re: Load Test

by Yadika Prasad -
I had a mock test with 100 of the students today scattered in 4 four courses. Nothing major happened. Ya gathering 250 for test won't be an easy task. I'll give the password too and follow 5 pages. OpCache is tuned. With today test and other measures hopefully it would work. Thanks again
In reply to Yadika Prasad

Re: Load Test

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

You wrote:
> I had a mock test with 100 of the students today scattered in 4 four courses. ... Ya gathering 250 for test won't be an easy task.

If the plan is to run the test in four batches of 60 candidates, then you need only 60 candidates for the mock test. Sure 100 is better. No need to gather 250 candidates!

> Nothing major happened.

What or where did you expect something to happen? This is what I wrote:
>> monitor how the server behaves. Polish any rough edges. Detailed instructions on those two and other topics are in the forum documentation mentioned earlier.

Please don't start changing configurations in the server because they supposedly improve performance! The process is to "monitor how the server behaves. Polish any rough edges" and documented in numbers (like server saturated at 100 candidates ramping up in 10 sec, after change 120 could). The whole exercise only if needed. If you see that 100 candidates are well withing the saturation limits of the server, don't do anything! Over medication can make sick too.
In reply to Visvanath Ratnaweera

Re: Load Test

by Yadika Prasad -
Thank you for all the guidance. We worked with 120 and added a few extra descriptive type to make things easier. 6 batches for 6 days max no 200 at the same time with 35 questions.
Went on smoothly from second day. The first day there was a momentarily "not able to login".
In reply to Yadika Prasad

Re: Load Test

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Congrats! 120 simultaneous quiz users are a lot for a VPS with 4 vCore, 8 GB RAM.

One can always tune further, but don't make drastic changes, why change a winning horse?
In reply to Yadika Prasad

Re: Load Test

by Usman Asar -
Picture of Plugin developers Picture of Testers

Although Visvanath has clearly brought forward everything, how many questions does quiz have? try not to keep one question per page, but say for example if you have 200 questions, then divide in such a way that every page has at least 5 questions, this way the calls to database will be lesser and server wont take much load.

keeping one question per page means users will be answering and hitting next button so DB will be getting hammered too quickly.

make sure OpCache is enabled and tuned (allocate at least 512MB memory to it)

Average of ratings: Useful (2)
In reply to Usman Asar

Re: Load Test

by Yadika Prasad -
thank you i will be sure to follow
In reply to Yadika Prasad

Re: Load Test

by Developer CK -
Although upper post have already put the point to consider, still i want to share my experience based on moodle 3.8+

  •  I am not sure if you have DB on same server or another. If this is on another server, this will definitely help you, if it is on same, user may face issues.
  •  cross check for the auto save time in quiz
  •  if your site is using https, then it is a good idea to offload the ssl before forwarding actual request to computing machine , (in case of apache, offloading ssl , will surely put an impact on connection performance)
  •  as in every request there will be static resources. Although those are cached, if we served through CDN or nginx proxy cache, this will improve the performance on computing server.
  •  number of questions per page will help a lot in case of load as @usman said.
  •  as i can see from your question, there will be 250 active user for 2 hour session. the panic moment will be when users will be doing a login. You can decide that time frame, and restrict other user to not login at your portal.
  •  It is just not about login user, other not-logged in user can also make requests to load your site. Take that into consideration as well.
In reply to Developer CK

Re: Load Test

by Yadika Prasad -
I may not be able to stop the other users from logging in at that time. Ya but they won't be doing anything major. The database is in the same server.
Noted
In reply to Yadika Prasad

Re: Load Test

by Ken Task -
Picture of Particularly helpful Moodlers

2 cent contribution ... since DB and DB server on same server, suggest (if Linux) installing MySQLTuner.  It's a perl based application that checks MySQL/MariaDB DB and makes recommendations for DB server tweaks.  Balancing act between web server and DB server.

Worth installing and running - especially now that you've begun some testing.

'SoS', Ken

Average of ratings: Useful (2)