Featured in
Architecture & Design

Mini-talks: The Machine Intelligence Landscape: A Venture Capital Perspective by David Beyer. The future of global, trustless transactions on the largest graph: blockchain by Olaf Carlson-Wee. Algorithms for Anti-Money Laundering by Richard Minerich.

Featured in
Process & Practices

In-App Subscriptions Made Easy

There are various types of subscriptions: recurring, non-recurring, free-trial periods, various billing cycles and any possible billing variation one can imagine. But with lack of information online, you might discover that mobile subscriptions behave differently from what you expected. This article will make your life somewhat easier when addressing an in-app subscriptions implementation.

Featured in
Operations & Infrastructure

Mini-talks: The Machine Intelligence Landscape: A Venture Capital Perspective by David Beyer. The future of global, trustless transactions on the largest graph: blockchain by Olaf Carlson-Wee. Algorithms for Anti-Money Laundering by Richard Minerich.

Featured in
Enterprise Architecture

Mini-talks: The Machine Intelligence Landscape: A Venture Capital Perspective by David Beyer. The future of global, trustless transactions on the largest graph: blockchain by Olaf Carlson-Wee. Algorithms for Anti-Money Laundering by Richard Minerich.

In this databases roundup we take a look at a new data sharding plug-in for ActiveRecord and how Postgres data access can be improved with the asynchronous client API.

Data Sharding for ActiveRecord

Data sharding is a technique to break a database into small partitions and to distribute them over several servers to improve the performance and scalability. How the data is partitioned is highly application dependent, eBay for example could partition by article category.

ActiveRecord does not support data sharding out of the box—this is where FiveRuns' DataFabric comes into play. DataFabric is an ActiveRecord plug-in that adds data sharding and also replication abilities to your models.

Introducing sharding into your models is quite easy, as this example from the README shows:

Faster IO for Postgres

In other database-related news, Muhammed Ali was able to boost Ruby's Postgres access by about 40%. He uses Postgres' asynchronous client API and Ruby 1.9 Fibers to implement a nonblocking connection pool and a fiber pool. The interaction from the user program's perspective looks as follows:

[..] once a fiber calls cpool.exec the query is sent to the pool for processing and the fiber is halted, giving way for another one to start processing. The other one will halt as well once it hits a cpool.exec. Later during the event loop you will get notifications of completion of queries (in any order) and resume the fiber associated with the finished query.

Muhammed also thinks about working on a better integration with EventMachine, which might improve the performance even more. Take a look Muhammad's Blog where he describes his analysis in full detail and the code he used.