Moodle performance optimizations

35

description

This presentation builds on a 6 month student project about measuring the performance of a moodle installation, and suggestions for what can be done to improve the performance, without changing the code. This presentation summarises our testing method, and our performance recommendations

Transcript of Moodle performance optimizations

Page 1: Moodle performance optimizations
Page 2: Moodle performance optimizations

WelcomeITU Innovators

IT KartelletTalk

Coffee & Networking

Page 3: Moodle performance optimizations

ITU Innovators

● Student Entrepreneurial OrganizationDriven by volunteers

● VisionConnecting students with startup companies, advisors, incubators, events, networking, ...

● EventsArranging and attending talks, workshops, competitions, meetings, ...

Page 4: Moodle performance optimizations

IT Kartellet

● IT-consultancy● Software development● Hosting● Moodle/Drupal experience● ASP.NET (MVC)

Copenhagen Tech Talks

Page 5: Moodle performance optimizations

Scaling Moodle

● Independent student project fall 2013 under the supervision of Kasper Østerbye

● Collaboration with the IT department of ITU (LearnIT)

● Collaboration with ITK (Moodle consulting)

Page 7: Moodle performance optimizations

What is Moodle?

● Modular Object-Oriented Dynamic Learning Environment

● Open source● Open University - 700.000 users, 6.000

courses● So it does scale - but how?

Page 8: Moodle performance optimizations

Scalability basics

● Vertical / scaling up● Horizontal / scaling out

○ X-axis○ Y-axis○ Z-axis

● Combining○ Performance○ Fault tolerance○ Fault isolation

Page 9: Moodle performance optimizations

Moodle architecture

Minimum Example setup

Page 10: Moodle performance optimizations

● 20.000 students● High availability requirements -

no downtime is allowed● All components should be

fault tolerant

CBS - Learn

Page 11: Moodle performance optimizations

● 2.500 students● Permits for small

windows of downtime

● Should handle large file uploads from games and digital media students

ITU - LearnIT

Page 12: Moodle performance optimizations

Moodle as a black box

● ...or a number of black boxes● Large community● Developed over many years● Limited documentation● How can we make the best out of it?

Page 13: Moodle performance optimizations

Testing approach

● Repeatable● Automated● Well documented ● Organized● Comparable● Targeted

Page 14: Moodle performance optimizations

User request simulation

Page 15: Moodle performance optimizations

User request simulation

● Simply HTTP Requests● Realistic input and randomization● Client-side measurements● Why jMeter?

Page 16: Moodle performance optimizations

Server-side measurements

● Monitor/record during test● Compare to everyday usage● Invaluable monitoring tools

○ iostat○ inotify○ htop

Page 17: Moodle performance optimizations

Server-side measurements - iostat

● Monitoring of cpu/storage activity● Repeated measure with given interval● Most relevant columns

○ iowait, avgqu-sz, await● More details: http://linuxcommand.org/man_pages/iostat1.html

Page 18: Moodle performance optimizations

Server-side measurements - inotify

● Monitor all files access, open, write etc.● More details:

○ inotifywatch http://linux.die.net/man/1/inotifywatch

○ inotify-win https://github.com/thekid/inotify-win / JNotify http://jnotify.sourceforge.net/

Page 19: Moodle performance optimizations

Server-side measurements - htop

● When does the server give up - when is it trashing itself in terms of CPU / memory?

● Adjust the server settings accordingly - max number of threads, concurrent users etc.

Page 20: Moodle performance optimizations

Immediate visualisation

Page 21: Moodle performance optimizations

Immediate visualisation

Page 22: Moodle performance optimizations

Test and visualisation process

Shell script JMeter R script

Number of usersList of serversRamp-up

Status codeUserResponse time Diagram

Server-side

Variousmeasurements

R scriptDiagram

Page 23: Moodle performance optimizations

Case exampleFile storage and cache

Page 24: Moodle performance optimizations

● Moodle requires shared cache

File storage and cache

Page 25: Moodle performance optimizations

Data properties

● Shared vs. Local● Volatile vs. Non-Volatile

Local

Shared

Shared

Local

Strings, plugin data, config, database meta

Update Logs

File-store, Temporary files

VolatileHtmlpurifier, question data, course contacts

Non-Volatile

Page 26: Moodle performance optimizations

Baseline (single shared NFS)

MoodleHDD - File store - Language strings - Plugins data - Config - Htmlpurifier - Question data - Course contacts - Database meta - Temporary files - Update logs

Web server 1

Moodle

Web server 2

NFS

Page 27: Moodle performance optimizations

Local volatile cache

MoodleHDD - File store - Htmlpurifier - Question data - Course contacts - Temporary files - Update logs

Web server 1NFS

APC - Language strings - Plugins data - Config - Database meta

Moodle

Web server 2

APC - Language strings - Plugins data - Config - Database meta

Page 28: Moodle performance optimizations

Shared volatile cache

MoodleHDD - File store - Temporary files - Update logs

Web server 1

NFS

Memcached

RAM - Language strings - Plugins data - Config - Database meta - Htmlpurifier - Question data - Course contacts

Moodle

Web server 2

Page 29: Moodle performance optimizations

Case exampleDatabase

Page 30: Moodle performance optimizations

Database load

● Sessions● User access rights● Courses● File meta data● ...

Page 31: Moodle performance optimizations

Single instance

● Easy to set up● ACID● Single point of failure● All load on a single server● Vertical scaling

Page 32: Moodle performance optimizations

Cluster setup

● Redundancy (X-axis)● Specialisation (sharding)

○ Y-axis○ Z-axis

Page 33: Moodle performance optimizations

Scaling Open Source

● Open source code - not build with scaling in mind - will only scale “prettily” if redesigned, but we can do it!○ A lot can be achieved by configuration

● A different approach to contributing to open source!○ We were imagining to be able to walk right in and

point out where moodle developers were wrong○ However, we ended up not changing a single line of

moodle code

Page 34: Moodle performance optimizations

Questions?

Page 35: Moodle performance optimizations

Coffee & Networking