YAPC::NA 2014 • Orlando, FL

Blocking Operations, Exceptions, and Logging in Asynchronous Servers

By Doug Hoyte (‎fractal‎) from Toronto.pm
Date: Tuesday, 24 June 2014 09:30
Duration: 20 minutes
Target audience: Intermediate
Language: English
Tags: anyevent async asynchronous events exceptions logging operations

You can find more information on the speaker's site:


This talk is about lessons learned while designing, building, and operating asynchronous servers. Instead of focusing on the concepts of async programming and the benefits it provides in terms of performance and determinism, we'll discuss the problems that inevitably come up.

Although not the only solutions to these problems, this talk describes three modules that your users, other developers, and operations team will appreciate:

AnyEvent::Task -- Doing any sort of blocking operation in an async server will ruin your performance. AnyEvent::Task is a pre-forked worker-pool implementation that lets your async program safely and efficiently perform any sort of blocking operation, including CPU-bound tasks.

Callback::Frame -- Exception handling is notoriously difficult in async servers. Callback::Frame unifies the various error-handling techniques used by different async libraries and even lets you do the right thing when exceptions are thrown in AnyEvent::Task worker processes.

Log::Defer -- Because in async servers you can't use process or thread IDs to follow a connection's progress, log files are often jumbled and confusing. Log::Defer implements an async-friendly style of logging known as structured logging that also supports timing data collection, flexible queries, and the log-defer-viz visualisation tool.

Attended by: