Mojoconf 2014 - Course Information

When and where

The course will take place at y3o, 23rd of May from 09:00 to 16:30.

The course is sold out. Contact us if you have questions regarding the course.

Non-blocking services with Mojolicious

The course will introduce and prepare the student to implement, troubleshoot, and debug non-blocking clients and web-services quickly and succinctly, giving apps unprecedented scalability, handling 100s and even 1000s of effectively simultaneous actions per process.

Prerequisites

Students are expected to have a basic familiarity with Perl and web development. For those that need to brush up, http://qntm.org/files/perl/perl.html is an accessible, free resource. Skimming over the tutorial at http://mojolicious.org/perldoc/Mojolicious/Lite and the first four guides listed on http://mojolicious.org/perldoc/ will do.

Students are recommended to bring laptops running OSX or Linux. Windows will work for much of the labs, although high performance examples may not operate as expected.

Please arrive with Perl 5.16.3+, Mojolicious 4.98+, App::cpanminus and Modern::Perl installed. For those using lower versions of Perl, http://perlbrew.pl is recommended. Please contact us if you have questions or need help arriving prepared.

# Modules can be installed using the following command:
$ curl -L cpanmin.us | perl - Mojolicious Modern::Perl App::cpanminus

# System wide using --sudo
$ curl -L cpanmin.us | perl - --sudo Mojolicious Modern::Perl App::cpanminus

If the student can answer these questions easily, they are ready for the course. If not, the student can get up to speed using their favorite search engine. The student needs to have created at least one simple client script using Mojo::UserAgent and one simple daemon using Mojolicious or Mojolicious::Lite.

  • What is a URL?
  • What is a URL parameter? How is it specified within a GET request?
  • What is the difference between a POST and a GET request
  • What is an API?
  • What’s the difference between a web page and a web application?
  • What would a database be used for?
  • How is a Perl script executed from a terminal?
  • How do you create and call a Perl subroutine?
  • How do you instantiate an object?

Format

Course will be split up into lecture and lab sessions. Some labs, the students will work together. The instructor will be available for questions during the course of all labs. If the instructor is asked questions during the lecture, he will answer based on the fanciness of the respective student's outfit. Glitter definitely helps.

Written Material

Student will receive written material covering the topics of the class.

Coverage

Coverage of material may change depending on the pace of the students. Some topics may be skipped, but will be included in written material provided to the student.

Morning Lecture (1.5 hours)

Non-blocking theory

  • Why it’s important
  • High level explanation of how it’s done in Mojolicious
  • Goals of non-blocking behavior - performance vs scalability

Implementation examples and explanation

  • Sleeping without blocking
  • Web scraping with Mojo::UserAgent
  • Demonstration of difference between blocking and non-blocking web scraping
  • Using callbacks and their drawbacks
  • More advanced and maintainable alternative to callbacks
  • Serial execution: alternative to callbacks

Break

Morning Lab (1.5 hours)

  • Implementing non-blocking sleep
  • Web scraping with callbacks
  • Embedded callbacks
  • Non-blocking without callbacks

Lunch

Afternoon Lecture (1.5 hours)

Implementation examples and explanation

  • Using non-blocking on the server side
  • Server being an abstraction for remote non-blocking APIs
  • Concurrent and serialized non-blocking calls
  • Authentication: using blocking bridges vs using non-blocking bridges
  • Converting blocking applications to non-blocking: techniques and gotchas
  • Troubleshooting non-blocking, how it differs from blocking

Break

Afternoon Lab (1.5 hours)

Implementation examples and explanation

  • Implementing a non-blocking server API that consumes remote APIs
  • Implementing non-blocking authentication
  • Implementing concurrent, serial, and mixes of the two

Troubleshooting practice

  • Troubleshooting provided non-blocking problem, practice of troubleshooting techniques

Biography

Glen (tempire) Hinkle is a core developer for Mojolicious, as well as the author of the Mojocasts. He’s used Perl for nearly 15 years, is a fan of functional programming, and likes pretty things.