BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Facebook Open-sources Haxl: Implicit, Concurrent Data Access Using Haskell

by Roopesh Shenoy on Jun 11, 2014 |

Facebook has open-sourced Haxl, a library for efficient, concurrent data-access. The library leverages the traditional strengths of Haskell such as expressive type system, correctness and safety guarantees, as well as GHC's high performance run-time to solve the thorny issue of implicit, concurrent data access.

Haxl simplifies data access to remote data, such as databases or web services. It can automatically batch multiple requests to the same data source, request data from multiple data sources concurrently and also cache previous requests. Jon Purdy, one of the engineers who worked on Haxl, explains -

The basic idea here is that you can write naïve data fetching code that looks horrifically inefficient—queries in loops, no explicit deduplication—which gets turned magically into efficient concurrent fetching under the hood.

To use Haxl in your application, you need to create a thin layer that denotes your data source, and describes how to access it.

Haxl uses the Applicative type class to allow computations to be implicitly concurrent. You can read more about how it works in this presentation. The library can be found on hackage and you can access the source code on GitHub

Haxl is a successor of FXL, which solves the same problem. Although FXL also has a pure execution model, it's implementation apparently has performance issues, especially with CPU and memory usage. Using Haskell, with the GHC, was the best alternative. You can learn more about the Story behind Haxl and the use-cases that Facebook currently uses it for.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT