erseco / alpine-moodle

Moodle docker image based on Alpine Linux
https://hub.docker.com/r/erseco/alpine-moodle
MIT License
44 stars 34 forks source link

Memory required for this baseline setup #29

Closed ernani closed 1 year ago

ernani commented 1 year ago

Hey, this is an amazing clean way to run Moodle! Congrats!

I've seen you are keeping this really up to date, great job!

I've noticed the mention for 100 concurrent users per replica, right? How much memory and CPU do you dedicate for each replica to satisfy this metric?

Also, curious to see if you'd be willing to contribute to our https://github.com/Google/moodle-on-gcp repo.

We are currently seeing great results with Moodle's Bitnami images but yours seems to be quite lighter and simpler to adopt.

Best Regards!

erseco commented 1 year ago

Hello,

Thank you for your kind words! I'm thrilled that you've found the Moodle deployment to be useful and up-to-date.

In my setup to accommodate up to 100 concurrent users per replica, I typically dedicate at least 2 vCPU and 8GB of RAM per replica. This should comfortably support typical Moodle activities for a user base of this size. Please note, however, that these values can be adjusted based on specific use cases, the complexity of your Moodle site, user interaction levels, etc.

Furthermore, I strongly recommend monitoring your setup to ensure its smooth operation. You can utilize tools like Kubernetes Metrics Server or Google Cloud's Monitoring and Logging.

As for contributing to the Google/moodle-on-gcp repository, I'm absolutely open to it! I believe in the benefits of open-source collaboration and am eager to contribute my insights to a broader community.

Let me know how you would like to proceed. Would you prefer that I submit a PR (Pull Request), or would you like to discuss a particular issue in more depth first? Please feel free to point out any areas where you believe my expertise might be most useful.

Best Regards!

ernani commented 1 year ago

Happy to recognize someone's effort to keep things simple and secure, accurate and up-to-date.

Thanks for your prompt reply and willing to help! I really appreciate that!

I am unsure if you do have an environment in Google Cloud to play with it, perhaps Minikube?

I am wondering if it should really need that amount of RAM initially...our pods in the Moodle effort for Bitnami's image has a 1G limit due to the restrictions on replicas and node sizes. It also uses Apache to serve requests, which, takes, IMHO, a lot of RAM and loads PHP module for all requests, where nginx won't due to the FPM architecture.

I think we can even start with using CloudRun, so that we can inspect the memory usage and run a few tests with a single instance to see how much it sustains load with a 100 concurrent user request.

I work for Google Cloud in the Public Sector and the Education sector, and, we have many customers already using it with GKE with great numbers, but as you may know, there is always some room to improvement.

You are free to contribute with your own image, either by adding a submodule to it in that repo or creating a copy if necessary.

I don't think in that case you'd need anything else, as the other components are substantially managed services which can be tuned within itself.

I appreciate the collaboration here and let me know if you need anything from me.

Cheers!

erseco commented 1 year ago

Hello,

Thank you for your acknowledgement and detailed insights. I can see your point on streamlining the resource utilization and you bring up some very interesting possibilities with Minikube and GKE. I'm delighted to know of your engagement with Google Cloud, and your proactive approach towards improvement is commendable.

I currently do not have a paid account on Google Cloud, but your suggestion has prompted me to consider acquiring a trial account for experimental and testing purposes. This could provide a valuable playground for exploring various configurations and optimizations.

On the matter of the Moodle image, I will look into the feasibility of substituting the Bitnami image with my own alpine-moodle version in the https://github.com/erseco/moodle-on-gcp/blob/main/4-moodle-image-builder/Dockerfile It could indeed present an opportunity for performance improvement.

Please note that while my endeavor is to contribute in the best way possible, it may take some time for me to navigate through the initial setup and integration process. I hope for your understanding in this regard.

I am grateful for the opportunity to collaborate and contribute. Please feel free to share any further insights, recommendations or requirements. Your guidance is always appreciated.

Best Regards,

jimsihk commented 1 year ago

Sorry to jump in and I would like to also share some info on my running setup as a reference. I have been running my forked version on Oracle Cloud Kubernetes (on ARM). As a minimal set, it will take around 200-300MB of memory for a functioning Moodle cluster:

image

BTW, for a HA setup this image might need some more modification to avoid starting up with maintenance mode; otherwise whenever there is auto scaling by the HPA, it will cause interruption. Related line is here: https://github.com/erseco/alpine-moodle/blob/master/rootfs/docker-entrypoint-init.d/02-configure-moodle.sh#L101 My way is to add a new parameter to control: https://github.com/jimsihk/alpine-moodle/blob/dev/rootfs/docker-entrypoint-init.d/02-configure-moodle.sh#L210

erseco commented 1 year ago

Hi @jimsihk,

Thank you for jumping in and sharing the details of your running setup on Oracle Cloud Kubernetes. It's great to see such innovative implementations and use of resources.

I appreciate your idea about the AUTO_UPDATE_MOODLE parameter. It's indeed a valuable addition which can help in better management of the Moodle setup, especially when it comes to handling maintenance mode during auto scaling. If you're up for it, I'd be happy to review a Pull Request incorporating this feature into the main version.

Regarding the upgrade of Moodle in a clustered version, it's a challenging task due to the distributed nature of clusters. If you have any specific methods or strategies in mind, I'd be more than happy to hear and discuss them. This is an area I'm definitely interested in improving.

Thanks again for your input and collaboration!

Best, Ernesto