CSC/ECE 517 Fall 2017/E17A8. Use a profiler to identify the problems / pages that take some time to load & fix them: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 22: Line 22:
== Pages which needs to be optimized ==
== Pages which needs to be optimized ==


1) http://localhost:3000/tree_display/list
1)expertiza.ncsu.edu/tree_display/list


2)https://expertiza.ncsu.edu/review_mapping/response_report
2)expertiza.ncsu.edu/review_mapping/response_report


3)https://expertiza.ncsu.edu/grades/view
3)expertiza.ncsu.edu/grades/view


== Approach ==
== Approach ==

Revision as of 22:10, 4 November 2017

Optimization for page loading in Expertiza

Introduction

Expertiza is an online system that is used by students to view/submit assignments and review others' work. Expertiza also provides tools to visualize the scores and gauge the improvements made during the course semester. It also facilitates and monitors team projects. It is targeted at educational and non-profit organizations. The project is funded by the National Software Foundation (NSF), NCSU Learning in a Technology-Rich Environment (LITRE) program, the NCSU Faculty Center for Teaching and Learning, the NCSU STEM Initiative, and the Center for Advanced Computing and Communication.

Expertiza is an open-source project with the source code available as a public repository on GitHub. It is developed using Ruby on Rails and is increasingly becoming robust thanks to the innumerable bugs being fixed by the community. The project has a micro-blog on SourceForge where the developer community report bugs and document updates.

Task Description

1) Identifying the Expertiza project pages which takes time to load using Rack-mini-profiler and Flamegraphs. 2) Propose fixes which would improve the Expertiza project 3) Optimizing the view ,models and controllers for few of these corresponding fixes to improve the load time of these pages

Gems Installed

  • rack-mini-profiler :- Middleware that displays speed badge for every html page. Designed to work both in production and in development
  • flamegraphs :- Flame graphs are a visualization of profiled software, allowing the most frequent code-paths to be identified quickly and accurately.
  • stackprof:-A sampling call-stack profiler for ruby 2.1+.Downloaded as a dependency for rack-mini-profiler.
  • fast_stack :-fast_stack is dynamically resizable data structure optimized for fast iteration over the large arrays of similar elements avoiding memory fragmentation.


Pages which needs to be optimized

1)expertiza.ncsu.edu/tree_display/list

2)expertiza.ncsu.edu/review_mapping/response_report

3)expertiza.ncsu.edu/grades/view

Approach

In order to optimize we need to understand the factors which is causing the lag , it can be basically identified by using the flamegraph generation and rack-mini-profiler statistics. The statistics generated by rack miniprofiler helps us to understand the time taken by each component to get loaded. From these statistic we can identify the model/controller/view/database query which is causing this latency. From here we can identify the methods which needs to be refactored in order to optimize the webpage rendering.

Identification of pages

Analysis of page1

The following is the flamegraph for this page:-



The following is the rack-mini-profiler statistics for the page:-







Identified Component causing the delay

tree_display_controller

The following methods are consuming most of the time in this code :-

1)update_fnode_children

2)initialize_fnode_update_children

3)children_node_ng

These methods are from line 172-201 in this controller.