BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

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

| by Roopesh Shenoy on Jun 11, 2014. Estimated reading time: 1 minute |

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.

Rate this Article

Adoption Stage
Style

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

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT