Category Archives: Akka

Akka-based Database for Graphql

I build a project called GraphqlAkka: https://github.com/hustnn/GraphqlAkka

It is an Akka implementation backend data store for Graphql.

Graphql is proposed by Facebook http://graphql.org/.

This project tries to utilize the Akka to implement an efficient, robust and large-scale backend data storage system for Graphql. The mobile applications from billions of devices can efficiently perform the query using the language provided by Graphql and get the answers from the unified GraphqlAkka store (huge amount of data) as faster as possible (our objective is minimizing this response time for each mobile request and also maximizing the data access throughput for all devices).

Based on the Akka implementation, each record in GraphqlAkka is an actor in Akka which means that the origin optimizations need to be revisted and re-optimized in this scenario. It is challenging but it is also very interesting.

Techniquies we used in the project:
Graphql Akka core, Akka sharding, Akka persistent(levelDB or Cassandra), Akka http.

I have already attempted to show how to support graphql by utilizing akka actor as the backend data store which is shown in the current codebase. Currently, the query is parsed in our akka http layer, then the data request is sent to the corresponding actor and get the responses. It shows that my prososal is possbile and I will continue to finish this interesting project.

Test:

After running it, you can input the query like this and get the result:


curl -X POST localhost:8080/graphql \ -H "Content-Type:application/json" \ -d '{"query": "query Test($humanId: String!){human(id: $humanId) {name, homePlanet, friends {name}}}", "variables": {"humanId": "1000"}}'

Stay tunned for a complete prototype.

I am implementing it use my leasure time. It is very interesting and challenging to if we want to get a highly efficient store for Graphql. Welcome to join me if you are interested in it.

Heterogeneous Computing with Actor Model

Actor-based model is a simple and high-level abstractions for parallel and concurrent programming. It is an asynchronous, non-blocking and efficient event-driven programming model. The actor is the very lightweight event-driven processes in the actor-based model which naturally fits the concurrency and parallelism (several million actors per GB of heap memory [1]). These actors can be distributed, deployed and scheduled into different computing devices, different machines and even different times slices of the physical devices without any impact on the correctness of the results. The actors are completely decoupled in terms of the space (distributed) and time (asynchronous).

Akka is an actor-model implementation in the JVM platform. Everything in Akka designed to work in a distributed environment. Each actor instance in Akka is the basic particle size and Akka guarantee each operation of the actor instance is atomic. All interactions of actors use pure message passing. Every behavior is encapsulated inside the one actor which makes everything inside Akka is asynchronous. One actor cannot block the behaviors of the other actors. You can benefit synchronicity and lockless concurrency without hassle from Akka.

Recently, modern many core hardware such as Intel Xeon Phi, graphics processing unit (GPUs) or many other coprocessors are increasingly available for general-purpose computation [2, 3, 4]. These heterogeneous designs are already proved to be very efficient for many applications, such as Deep Learning [5] and Database [6]. Due to actors is designed from scratch especially for the highly distributed and parallel environment, they tend to be a better fit for parallel processing units. We are developing a new heterogeneous computing platforms based on Akka. It can simplify the development on these heterogeneous architectures and can provide efficient computing ability with the help of the power Akka.

[1] http://akka.io/docs/
[2] Manyfold Actors: Extending the C++ Actor Framework to Heterogeneous Many-Core Machines using OpenCL
[3] Efficient Query Processing on Many-core Architectures: A Case Study with Intel Xeon Phi Processor
[4] Revisiting Actor Programming in C++
[5] TensorFlow: Large-Scale Machine Learning on Heterogeneous Distributed Systems
[6] http://blazingdb.com/