Is there is a general recommendation ,?
Optimize a small vps server
Number of replies: 27Re: Optimize a small vps server
Also worth taking a look at https://docs.moodle.org/en/Performance_FAQ.
Re: Optimize a small vps server
Visvanath's post is good.
Typically, cPanel provides you a "Terminal" tool, a tool that you will need to make optimization improvements. The two areas that come to mind are 1) Enabling opcache, and 2) fine-tuning your database via my.cnf. Sorry, I don't have any videos to help you, but the Moodle docs that Visvanath point you to are a good place to start.
There are probably some server-side settings, but I don't know enough about these to guide you.
Re: Optimize a small vps server
The original question brings me an idea. How about starting a competition? There are many hosting providers who offer VPS free for testing. Select one, and select a small VPS, say 1-2 (dedicated) vCPUs and 2-4 GB RAM. The candidate who gets the maximum out of it wins a prize. The "maximum" could be the max. number of users logging in or opening a given quiz, say within 10 sec.
Re: Optimize a small vps server
I have used this "perspective.php" file, which I got many years ago here on Moodle.org, as a way to get some server statistics. Put this file into your moodle folder and then go to www.yourdomain.com/yourmoodle/perspective.php.
Speed test
In one second you can do...
- 10512000 function calls
- 59000 16KB files read from disk (cache)
- 33600 regular expression replaces over 1KB of text
- 6600 16KB files written to disk (cache)
- 10110 get_record calls on the course table
- 8750 insert_record calls on the course table
- 8350 update_record calls on the course table
- 1.12 seconds to delete 8750 entries
Speed test
In one second you can do...
- 18532000 function calls
- 80800 16KB files read from disk (cache)
- 33100 regular expression replaces over 1KB of text
- 4100 16KB files written to disk (cache)
- 12690 get_record calls on the course table
- 5070 insert_record calls on the course table
- 8990 update_record calls on the course table
- 0.98 seconds to delete 5070 entries
Script took 14.52 seconds to execute.
My VPS appears to be, in general, faster!Re: Optimize a small vps server
About the perspective comparison: What is the (virtual) hard- and software on your desktop and VPS?
Re: Optimize a small vps server
On my VPS, it's CentOS 6 (yep, need to upgrade soon) and MariaDB. My VPS is not using an SSD drive. (My next VPS will have SSD.)
Both places have the exact same Moodle, Moodle 3.9.1+ (Build: 20200814). (I manually mirror these.)
Re: Optimize a small vps server
In one second you can do...
16513000 function calls
68700 16KB files read from disk (cache)
27100 regular expression replaces over 1KB of text
2300 16KB files written to disk (cache)
11240 get_record calls on the course table
2830 insert_record calls on the course table
7430 update_record calls on the course table
1.07 seconds to delete 2830 entries
Script took 14.93 seconds to execute.
--------------------------------------
is this results good ? (good for 20 concurrnt users, 1000 non concurrent)
Re: Optimize a small vps server
A while ago, there was some discussions where people had compared their results from perspective.php. Even the person who created this utility. I can't recall results trying to be correlated with number of users. So this perspective.php scipt is only a guide to the many ways that people might optimize their VPS.
Re: Optimize a small vps server
Does sound interesting. Perhaps restrict it to a single spec say 1 vCPU, 1 Gb of Ram. Might help to settle some questions ie Debian vs Centos, Apache/Nginx/whatever, MySql/Postgresql etc
Re: Optimize a small vps server
Yes, we need to come up with one, reproducible, server. I don't know how uniform the "cloud" servers of the same hosting are. That is why I said "dedicated vCPU" - whatever that means. Yes 1 vCPU / 1 GB RAM is possibly the lowest end VPS. I am not sure how relevant they are for Moodle. I was wondering between 1 vCPU / 2 GB RAM and 2 vCPU / 4 GB. Although some won't call the latter a "small VPS".
If we need something more geeky, a Raspberry Pi could be the server. Has the advantage that we are not limited to the usual 1 week testing time of hosting providers - and the hardware is consistent. (A 3 B is a 3 B - no versions and generations.) The down side is, since based on ARM architecture, the results may not be valid for x86.
Oh yes, the benchmarks. Here's a standard example: https://tjhunt.blogspot.com/2013/05/performance-testing-moodle.html.
Re: Optimize a small vps server
Re: Optimize a small vps server
I had used that "perspective.php" technique to fine-tune my database (my.cnf). And I recall using it before and after enabling opcache. It was my non-technical solution.
Over the next several months, my plan is to experiment with a Digitaalocean VM and another GoDaddy VPS. I do have Moodle on a Raspberry Pi, too, and maybe I can do some teesting.
I seem to recall discussion about Moodle adding a tool to do a server performance test. Might this happen when one "shows statistics." Maybe something already exists?
Re: Optimize a small vps server
all these topic is so advanced to me , i asked the a2hosring.com tech support about opcache , they tell me it is already enabled, " my.cnf" i even do not know what is this
the reason for my question is , on facebook group some one say that he can run concureently 1000 users do exam on a 16 gb ram , i asked him how , he say : with optimization
so i asked for any general optimzation that do require server adminstration knowledge
another thing i remember ,few months ago i need to increse the upload file limit , and did some modifcation
now i do not need that high limit
this is my cureent setting , should i modify some thing ?
now about 500 users , at most 10 concurrently , may increase to 20
Re: Optimize a small vps server
Re: Optimize a small vps server
- Opcache: Visit Site administration> Server > PHP info and search for "opcache". You should see something like this:

- "he can run concurrently 1000 users do exam on a 16 gb ram , i asked him how , he say : with optimization" People like to show-off, specially on social media. Just look at this statement and realize how vague it is: No number of CPUs mentioned, no mention of the disk storage systems (spinning disks, what technology, SSD, RAM disk,..), no mention of the stack (LAMP, LEMP), no mention of caching (memcached, Redis, ...) The size of the quiz not mentioned, how staggered the students are when they fetch the exam (all at the same second, or spread in a duration of 10 min).
If you have a specific need from a synchronous exam, formulate it carefully and ask in this forum for an estimation of the resources.
- About the file upload limit. It has no (direct) connection to server performance. What is the question: You need a higher limit?
Re: Optimize a small vps server
thank you so much
Re: Optimize a small vps server
Re: Optimize a small vps server
Litespeed is a webserver that replaces Apache, and in my experience has added 4x performance (some cases 10x) with the same hardware. Its paid software, price is based on the number of accounts on the WHM. My opinion, worth trying.
Re: Optimize a small vps server
I saw that you said it elsewhere:
- https://moodle.org/mod/forum/discuss.php?d=409707#p1653601
- https://moodle.org/mod/forum/discuss.php?d=409409#p1653236
Soon you'll get the chance to prove it. Get the same VPS as the others and show that Moodle can pull four times more!
Re: Optimize a small vps server
If you can try it you'll get amazed.
Re: Optimize a small vps server
Re: Optimize a small vps server
Also if your not satisfied with the results you can just disable it and add more Ram.
Would be great if you can share some before/after resource usage pics.



Re: Optimize a small vps server
I've read this thread a couple of times but most of it is beyond me and my non existing knowledge about servers and databases. I'm just a secondary school teacher who's trying to find a not-so-expensive hosting service to take my classes online. A couple of colleagues and I have 1000 students and we believe that the highest number of concurrent users could be 300 when taking a quizz. Someone recommended planethoster so I've taken a look at their hosting plans, however I'm not sure if it's enough to meet our needs. Would you be so kind to help and point me in the right direction towards if the following specs are enough (or close) to what we need?
It's a shared hosting "The World" plan:
32 CPU
64 GB RAM
64 MB/s DISK I/O
and it includes LITESPEED+LSCACHE (I still don't understand how Litespeed works, but since you've tried and recommended it I thought it might be a good idea to mention it)
Re: Optimize a small vps server
- A couple of colleagues and I have 1000 students
- and we believe that the highest number of concurrent users could be 300
- cpanel (tool to manage your hosting account)
- Litespeed server
- free SSL
- at least 2 CPU and 1GB memory (with Litespeed enabled, this can be enough for 200/300 concurrent users)
(this may vary depending on your specific moodle activities usage) - shared hosting provider that shares features specs (cpu, memory, free space)
- like greengeeks here https://www.greengeeks.com/support/article/greengeeks-shared-hosting-pricing
- like tmdhosting here https://www.tmdhosting.com/cloud-hosting.html#cloud-plans
- like planethoster here https://www.planethoster.com/en/HybridCloud-Servers
Some extra notes:
-choose a server location near you ie greengeeks has datacenter in USA and Europe.
-shared hosting that offer unlimited space limits max number of files. If you expect to use assignments this may be an issue.
-shared hosting limits the number of emails sent per hour, moodle can send many emails so this can be an issue.
Hope it helps!
Guillermo
Re: Optimize a small vps server
It really helps a lot since I'm a total newbie and have only had experience with one hosting provider who's already fallen short. I sincerely thank you for taking the time to even list some hosting providers.
Would you mind telling me how the assingments might be an issue when hoster providers limit the max number of files? Does that limit refer to hosted number of files? And knowing this is too much to ask for (only if you happen to have some spare time)but would you please give me your opinion about planethoster's "world plans"? Because you mentioned the hybrid plans but they start at $60.5 a month which is way off my budget (about $32/month). I understand this is not some kind of customer support, but I'm just afraid of making a wrong decision and not being able to afford a way to correct it.
Re: Optimize a small vps server
>>Would you mind telling me how the assingments might be an issue when hoster providers limit the max number of files?
In general assignments require users to upload a file to complete the task. Then when the teacher sends feedback it can add annotations over the file, which will generate a new file. So basically for every user participating you can have at least 2 files.
>>Does that limit refer to hosted number of files?
Yes, hosting providers who offer "unlimited space" limit the number of files on the account, they call it "inodes limit". Based on the plan it can be 300k, etc.
>>opinion about planethoster's "world plans"?
I understand you are referring to this https://www.planethoster.com/en/World-Hosting
The specs indicate very good amount of resources, if they are guaranteed to your account it should work ok with moodle.
Anyway I would ask support directly if the plan is compatible with moodle, also would ask about the "inodes" limit on the unlimited space offer.
Choosing a good hosting provider is not an easy task, what I would recommend is do all the questions you need before deciding and once you do, have a daily backup, even more than a daily backup, stored outside the hosting account, just in case you need to move to a new hosting.
good luck!