optimizing moodle lms to improve user response time

78
Optimizing Moodle LMS to Improve User Response Time Summer Internship Project 2013 Under the guidance of Professor D. B. Phatak Computer Science Department Indian Institute of Technology, Bombay

Upload: huey

Post on 25-Feb-2016

118 views

Category:

Documents


0 download

DESCRIPTION

Optimizing Moodle LMS to Improve User Response Time. Summer Internship Project 2013 Under the guidance of Professor D. B. Phatak Computer Science Department Indian Institute of Technology, Bombay. Project In charge : Mr. Nagesh Karmali Team Members : Miss Priyanka Manchanda - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Optimizing Moodle LMS to Improve User Response Time

Optimizing Moodle LMS to Improve User Response TimeSummer Internship Project 2013Under the guidance of Professor D. B. PhatakComputer Science DepartmentIndian Institute of Technology, Bombay

Page 2: Optimizing Moodle LMS to Improve User Response Time

Project In charge : Mr. Nagesh KarmaliTeam Members :Miss Priyanka ManchandaMiss. Akshaya MuralidharanMr. Surya Pratap SinghMr. Mevin Dominic Mr. Pawan DeshmukhMiss. Slipa ReddyMiss. Shabna T. R

Page 3: Optimizing Moodle LMS to Improve User Response Time

Agenda• Introduction to Moodle• Front-End Optimization Techniques• Study of Performance of Moodle• Back-End Optimization• Hardware Optimization• Client-server communication

mechanism For Moodle’s Quiz Plugin

• Policy Enforcement Framework

Page 4: Optimizing Moodle LMS to Improve User Response Time

Scope of the Project• Enhancing performance of web

applications• Delay of one second can reduce customer

satisfaction by up to 16%• Optimize Moodle ≈ Optimize Web

Applications

Page 5: Optimizing Moodle LMS to Improve User Response Time

Introduction to Moodle

Page 6: Optimizing Moodle LMS to Improve User Response Time

Introduction to Moodle• Modular Object Oriented Learning Environment.• Open Source Course Management System (CMS)• Developed by Martin Dougiamas designed for creating effective

online learning sites.• Focus on interaction and collaborative construction of content, and • First Version, 20 August 2002

Page 7: Optimizing Moodle LMS to Improve User Response Time

Moodle Statistics• 83059 currently active sites • 236 countries • 70,696,570 users• 7.5+ million courses • 1.2+ million teachers

Source : https://moodle.org/stats

Page 8: Optimizing Moodle LMS to Improve User Response Time

Moodle Architecture

Server

Page 9: Optimizing Moodle LMS to Improve User Response Time

FRONT – END OPTIMIZATION

Page 10: Optimizing Moodle LMS to Improve User Response Time

Techniques Discussed

• Caching by using Far Future Expires Header• Reduce DNS Lookups• Gzip Components• Deactivating Etags• Caching AJAX Components

Page 11: Optimizing Moodle LMS to Improve User Response Time

Caching By Using Far Future Expires Header• Browser uses cache to

Reduce the number of HTTP Requests Reduce the size of HTTP Requests Make web page load faster – reduce user response time

• Expires Header is used to inform client to use the current copy until the specified time.

• Moodle’s default Expires Header is set in past• (20th Aug 1969 09:23 GMT)

• Experiment for Expires Header in future (changing httpd.conf)

• (16th April 2015 20:00 GMT)

Page 12: Optimizing Moodle LMS to Improve User Response Time

Experimental Setup• 1GB RAM, • 128GB SSD • Intel® Core™ i5-2310 CPU @ 2.90GHz 4 Processor.• Chat activity

• Login -> View Course -> View Chat Page -> Initialize Chat -> Initialize Initial Update

• Looped 5 times:• Post Chat -> Initialize Chat Update

• 1 user and 1 iteration, 15 samples • Apache Jmeter.

Page 13: Optimizing Moodle LMS to Improve User Response Time

Results

Reduction of 74.14% in average user response time

Page 14: Optimizing Moodle LMS to Improve User Response Time

Reduce DNS Lookups• Internet finds servers through IP addresses• Domain Name Servers map hostnames to IP

addresses.• The browser is idle until the DNS lookup is completed.

EXPERIMENT:Calculated and Observed the difference in average user response time for a client on a network with average download speed of 2.035 Mbps

Page 15: Optimizing Moodle LMS to Improve User Response Time

Results

Reduction of 1.84 seconds in average user response time if the page is found in DNS Cache

Page 16: Optimizing Moodle LMS to Improve User Response Time

Reduce DNS LookupsScenario 1: DNS Cache Entries = 20DNS Cache Expiration Period = 60 secondsHTTP Keep Alive Timeout =115 seconds Scenario 2:DNS Cache Entries = 512DNS Cache Expiration Period = 3600 secondsHTTP Keep Alive Timeout =115 seconds Scenario 3:DNS Cache Entries = 512DNS Cache Expiration Period = 3600 secondsHTTP Keep Alive Timeout =0 second

100 iterations.

Page 17: Optimizing Moodle LMS to Improve User Response Time

Results

Scenario 2 provides the best results.• Increasing the number of DNS

cache entries • Increasing DNS expiration period • Network supports HTTP keep-alive

Average

Page 18: Optimizing Moodle LMS to Improve User Response Time

Gzip ComponentsAccept-Encoding header in the HTTP request.Content-Encoding header in the response.

Page 19: Optimizing Moodle LMS to Improve User Response Time

Gzip Components

Reduction of 617.818 KB in size of request after compression

Page 20: Optimizing Moodle LMS to Improve User Response Time

Deactivating ETags• Etag – Entity Tag identifies a specific version of a component• ETags are unique to a specific server hosting a site• Won’t match when a browser gets the original component from

more than one server and makes a conditional GET request that goes to a different server

• Deactivating Etags reduces the response Header size by 48 bytes.

Page 21: Optimizing Moodle LMS to Improve User Response Time

Caching AJAX ComponentsWith Ajax, Moodle can send data to, and retrieve data

from, the server asynchronously (in the background) without interfering with the display and behavior of the existing page.

To enable caching of AJAX Components in Moodle● Open /var/www/moodle/lib/outputrendering.php● Update the Expires header from past to supported

far future.

Page 22: Optimizing Moodle LMS to Improve User Response Time

Caching AJAX ComponentsFor Drag & Drop component:

Without Caching: 309 msWith Caching: 227 ms

Performance Improvement: 26.5%

Page 23: Optimizing Moodle LMS to Improve User Response Time

Study of Moodle Performance &

Bottlenecks

Page 24: Optimizing Moodle LMS to Improve User Response Time

Study of Moodle Performance & Bottlenecks• Tests were conducted using JMeter

• JMeter plugin for Moodle generates scripts for different activity modules

Page 25: Optimizing Moodle LMS to Improve User Response Time

Study of Moodle Performance & Bottlenecks

Page 26: Optimizing Moodle LMS to Improve User Response Time

Study of Moodle Performance & Bottlenecks• The tests are constructed for a built-in QUIZ

plug-in on Moodle with 1 question which involves

• Login• View Course• View Quiz• Start Attempt• Submit Quiz• Finish AttemptLogout.

Page 27: Optimizing Moodle LMS to Improve User Response Time

Comparing TimersConstant Timer: Each thread pauses for the same amount of time between requests.

Gaussian Random Timer: Each thread request for a random amount of time, with most of the time intervals occurring near a particular value.

Uniform Random Timer: Each thread request for a random amount of time, with each time interval having the same probability of occurring.

Constant Throughput Timer: This timer introduces variable pauses, calculated to keep the total throughput (in terms of samples per minute) as close as possible to a give figure.

Synchronizing Timer: The purpose of the SyncTimer is to block threads until X number of threads have been blocked, and then they are all released at once.

Page 28: Optimizing Moodle LMS to Improve User Response Time

Comparing Timers

Average Response Time (ms)

Page 29: Optimizing Moodle LMS to Improve User Response Time

Response Time vs Number of Users● Server Details: 2 Intel Xeon 6 core processor, 96 GB RAM, 1

TB HDD● Default Moodle setup with LAMP.● Ramp-Up Period : 1 s (To simulate real time traffic)● No. of loops : Forever● We test until we obtain a java.net.connectionexception due

to connection timeout.● The number of threads is increased from 100 in steps of

100.

Page 30: Optimizing Moodle LMS to Improve User Response Time

Response Time vs Number of Users

Page 31: Optimizing Moodle LMS to Improve User Response Time

Back End Optimization

Page 32: Optimizing Moodle LMS to Improve User Response Time

Moodle: Apache HTTP vs. LigHTTPd

Page 33: Optimizing Moodle LMS to Improve User Response Time

Comparing Apache HTTP and Lighttpd

Page 34: Optimizing Moodle LMS to Improve User Response Time

• mdl_backup_controllers table• 22,500 entries • 1.6 GB of space • biggest table in the database.

• script to deletes all controllers over a week old.#!/bin/bash mysql-u YOURDATABASEUSERHERE -pYOURPASSWORDHERE moodle <<EOF

DELETE FROM mdl_backup_controllers WHERE timecreated< unix_timestamp(now() - interval 7 day) EOF

Overcoming Table Size Limitations

Page 35: Optimizing Moodle LMS to Improve User Response Time

Improvement in Grading System• To create an instance of activity

• "modulename_grade_item_update()"• "grade_update()" function.

• Activity always has a grade of zero, • $glossary->scale==0 • $quiz->grade==0 • $hotpot->grade==0,

• Use parameter setting:• $PARAMS[‘gradetype’]=‘GRADE_TYPE_NONE’

• Result - no grade item created for the activity. • Activity may be edited , a non-zero grade becomes

possible. • Use the setting

• $PARAMS[‘gradetype’]=‘GRADE_TYPE_VALUE’

Page 36: Optimizing Moodle LMS to Improve User Response Time

Improvement in Grading System• Set Activity to zero

• "modulename_grade_item_update()" • set "gradetype" to GRADE_TYPE_NONE • call "grade_update()", • grade item not deleted from gradebook

• Result – Grade book contains an entry for an activity that can only ever get a zero grade.

• Not allowed to change back to zero/none value • Avoid activities with zero grade.

Page 37: Optimizing Moodle LMS to Improve User Response Time

Removing irrelevant links during quiz

• Communication of Moodle core and the plugin • looking for particular entry points, • defined in the file lib.php

• View.php prints a particular instance of real time quiz

• Changes made :• Define global variable $flag in the file /mod/realtimequiz/view.php• Set it's value to 1.• Value reset to 0 during quiz • Used to control the display of the links

Page 38: Optimizing Moodle LMS to Improve User Response Time

HARDWARE OPTIMIZATIONMEVIN .M. DOMINIC & PRIYANKA MANCHANDA

Page 39: Optimizing Moodle LMS to Improve User Response Time

SSD FEATURESDurability• Non Mechanical Design• NAND FLASH• Shock Resistant

SSDs are Faster• 10 – 100 times depending on the genereation• Speeds vary from some MB/s to a few GB/s.

SSDs Consume Less Power• 2W v/s 6W even at Peak Load

Page 40: Optimizing Moodle LMS to Improve User Response Time

SSD FEATURESSSDs are LighterAverage Case – HDD at least 10 times heavier

SSDs are Cost-Efficient• Expensive, $1.00 per gigabyte (based on buying a 240GB drive)• Only around $0.075 per gigabyte, very cheap (buying a 4TB HDD.

SSDs are Cooler

SSDs are Quieter

Page 41: Optimizing Moodle LMS to Improve User Response Time

An Experiment On Quiz Module• Objective : Database optimization• Experiment Details

• Five questions.• A mix of different types.• Two users• Quiz - a random way.• Queries logged.

Page 42: Optimizing Moodle LMS to Improve User Response Time

Query Log• Number of queries generated• Flushing the query log

Name of Activity Number of QueriesLogin 177

View Course 59Quiz 554

Logout 89

Page 43: Optimizing Moodle LMS to Improve User Response Time

Systems Used• Test done for Four different systems• Varying configurations of RAM & CPU.• 554 queries logged for quiz• Systems used

• HP laptop (HDD) -- CORE™ i3 processor (4GB RAM)• DELL XPS laptop (HDD) -- CORE ™ i5 processor (8GB

RAM)• DELL XPS laptop (HDD) -- CORE ™ i7 processor (6GB

RAM)• Desktop System (HDD+SSD) -- CORE ™ i5 processor

(4GB RAM)

Page 44: Optimizing Moodle LMS to Improve User Response Time

Results(in s) For Single UserTest No.

Core™ i3(HDD)(3M

2.40GHZ)

Core™ i3(HDD)(3M

2.40GHZ)

Core™ i3(HDD)(3M

2.40GHZ)

Core™ i3(HDD)(3M

2.40GHZ)

Core™ i3(HDD)(3M

2.40GHZ)1 4.13 3.09 3.96 3.17 0.752 4.24 3.69 3.13 2.60 0.773 4.61 3.49 3.23 2.62 0.754 4.03 3.13 3.12 2.62 0.76

Page 45: Optimizing Moodle LMS to Improve User Response Time

Factor - Single User• Average User Time for a single user

• HDD - 3.7525 sec• SSD - 0.7525 sec

• Factor = 3.65

Page 46: Optimizing Moodle LMS to Improve User Response Time

Results(in s) – 100 usersCore™ i5

(HDD)(6M

3.20GHZ)

Core™ i5(SSD)(6M

3.20GHZ)Time 287.187 77.881

Factor = = 3.68

Page 47: Optimizing Moodle LMS to Improve User Response Time

Conclusion• Factor of 3.5 for both single user and 100 users.• The latency at the database can be reduced loading

it in an SSD.• MySQL database supports more users for higher

RAM.• Hence SSD servers (e.g. Power Edge Series-DELL)

can boost up the performance of Moodle.

Page 48: Optimizing Moodle LMS to Improve User Response Time

Focusing over client-server communication mechanism(Moodle Quiz).

Page 49: Optimizing Moodle LMS to Improve User Response Time

Proposed Techniques for Experimentation1. Implementation of Long-polling.

(Applicable for real time use)

2. Random-Batch Mode Algorithm.

Page 50: Optimizing Moodle LMS to Improve User Response Time

Long PollingThe Web client keeps a pending connection that’s closed only when some updated response can be returned.Benefits:• A smaller number of requests to the server• Repeated Request method to check the

updated data takes time to established

Page 51: Optimizing Moodle LMS to Improve User Response Time

Figure Showing Long Polling

Page 52: Optimizing Moodle LMS to Improve User Response Time

Implementation to Moodle & Results

• Removing the timed-request code from plugin.• Adding code in Action Page to hold request and

check “status” variable.Results:• Reduced number of request by a factor of 3 for

every question.• Both the default and long-polling worked fine for

90 users • Improved overall throughput for long polling

Page 53: Optimizing Moodle LMS to Improve User Response Time

Random Batch Mode AlgorithmObjective:- Experimentaion aimed either to increase throughput, or the number of users.1. Users get grouped by random number and this is equal to the round in which he shall download the quiz.2.Batch with number 1 will be next to download the quiz and other batches shall wait for further round.3.The code was placed on the action page of attempt quiz button before “download the quiz” and timer starts.Thus individual time is not compromised.

Page 54: Optimizing Moodle LMS to Improve User Response Time

Testing with JMeter and ResultsSystem :- i3 processor, 3GB RAM , ubuntu 10.04Quiz settings :- display all questions on one page.1.For 60 users both the methods : The default and random number method worked fine with no much Throughput difference.(60 was upper limit of default method).2.For 75 users :The default method crashed, whereas The Random Number generation coded quiz worked fine, with just a single user unable to attempt the quiz.

Page 55: Optimizing Moodle LMS to Improve User Response Time

POLICY ENFORCEMENT FRAMEWORK

Page 56: Optimizing Moodle LMS to Improve User Response Time

Introduction•Basically used to regulate access permissions.•It deals with 1. users security 2. privacy concerns, • This is accomplished by allowing users to define policy rules.

Page 57: Optimizing Moodle LMS to Improve User Response Time

How it works??• A policy should be created first with all the rules.• An xml file is generated from these rules defined

and sent to the tablets.• Using this xml file the applications on the tablet can

be controlled.• Based on the rule defined a particular application

may be allowed or blocked.

Page 58: Optimizing Moodle LMS to Improve User Response Time

Policy Details or Rules•Policy Name•Validity•Priority•Policy Type•Package•Context

Page 59: Optimizing Moodle LMS to Improve User Response Time

POLICY ENFORCEMENTThe policy enforcement framework provides an interface to• Create Policy• Add context• Edit policy• Resequence priority• Generate xml file

Page 60: Optimizing Moodle LMS to Improve User Response Time

Create policy• Here the policy can be defined with all the related

information.• The details like name, priority, description,

command, validity of policy and package should be provided here.

Page 61: Optimizing Moodle LMS to Improve User Response Time

Create policy

Page 62: Optimizing Moodle LMS to Improve User Response Time

Add context• This can be used to add context to the

existing policies.• All the existing policies are listed here so

that user can add the context to any policy..

Page 63: Optimizing Moodle LMS to Improve User Response Time

Add context

Page 64: Optimizing Moodle LMS to Improve User Response Time

Edit policy• User can view all the existing policies and

modify them.• The validity of the policy can be changed or

the package can be changed.

Page 65: Optimizing Moodle LMS to Improve User Response Time

Edit policy

Page 66: Optimizing Moodle LMS to Improve User Response Time

Resequence• Two policies may conflict if they have same

priority. This can be resolved by re-sequencing the policies that conflict.

• This is a drag and drop interface where all the policies are grouped based on the priority.

• User can re-sequence them to solve the conflict so that the new sequence number will be updated in the database.

Page 67: Optimizing Moodle LMS to Improve User Response Time

Resequence

Page 68: Optimizing Moodle LMS to Improve User Response Time

Future Scope• If policy framework is integrated with Moodle as a plugin, we

can control the other applications while Moodle quiz is running on a tablet.

• Minimise most expensive from the database• Share the load generated on Moodle on different servers to

improve efficiency• The policy enforcement framework can be implemented as a

plugin to reduce the traffic while Moodle is running on a tablet

Page 69: Optimizing Moodle LMS to Improve User Response Time

What we learnt??• Load Testing By Apache JMeter• Optimization Techniques• In-Depth Understanding of Web Server and Client

Communication• New Hardware Capabilities (Solid State Disk)• Database Structure of Moodle• Working of Moodle• Long Polling Technique• Random Batch Mode Algorithm

Page 70: Optimizing Moodle LMS to Improve User Response Time

Tutorials on :Introduction to FrancePresent YourselfNumberColours Days of the WeekTranslate an English word to French.

Page 71: Optimizing Moodle LMS to Improve User Response Time

• Abacus is a calculating tool for performing arithmetic operations.

• Standard Abacus with 9 beads in each column representing the face value.

• Has 10 columns where each column represents a place value.

• Displays net value on abacus

Page 72: Optimizing Moodle LMS to Improve User Response Time

• Parameters like Distance, velocity are varying at every instant of time.

• By pressing lap button we can record data in laps.

• Once we stop buttons change to resume or reset. We can manage things accordingly.

Page 73: Optimizing Moodle LMS to Improve User Response Time

• This application intends to convey the basics of searching algorithm and also explains deeply about the concept LINEAR SEARCH which comes under the topic of Data Structures And Algorithms.

• The application discusses the algorithm and C++ code for the same.

Page 74: Optimizing Moodle LMS to Improve User Response Time

To thoroughly understand Mean, Median , Mode.a) Theory ,b) Self-check calculator,c) Infinite question generation quiz

section.

Page 75: Optimizing Moodle LMS to Improve User Response Time

• Time saving tips and tricks to perform maths calculations easily without using calculator.

• Helps the user a lot in improving his/her self confidence in maths

• Each and every trick is explained in a step by step manner with example

Page 76: Optimizing Moodle LMS to Improve User Response Time

Learn the formulas on just a click!  Math formulae is an educational application that helps the students to learn and solve formulas quickly with the help of rich graphical layout.

Page 77: Optimizing Moodle LMS to Improve User Response Time

REFERENCES[1] S. Souders, High Performance Websites. O'Reilly Media, 2007.[2] Borg, A. (2009, December 17). Web Site Performance: When Seconds Count. Re-trieved June 4, 2013, from technewsworld.com: http://www.techhnewsworld.com/story/68918.html[3] http://en.wikipedia.org/wiki/Policy_framework[4]http://www.it.iitb.ac.in/arndg/dokuwiki/index.php/User:Kaustubh

Page 78: Optimizing Moodle LMS to Improve User Response Time

THANK YOU