GSoC Status: Week 3

This week I spent most of my time implementing the MariaDB package, it is still incomplete but I’ve pushed it to Github, check it out if you are interested.

The problem I am currently stuck is for every continue part of the asynchronous version MariaDB APIs, we need to pass the ready_status(bitmask of all events occurred on a MariaDB connection socket) in able to issue the call. However, the socket event callback functions are spilt into five sepreated functions, and every function only knows the corresponding event it shall handle but no idea about all the events available on the MariaDB socket. This makes it more tricky to write the callback functions right, I need to make sure what events actually occurs on every stage of a MariaDB’s connection lifecycle.

Meanwhile, I am also discussing with Eduardo Silva to see what we can do with it. He did offer me some useful advinces and will show me some examples later. And as he recommended, we may add connection pool support to our MariaDB package to avoid connect-on-demand mechanism.

For the next week, I will keep hard working on making the implementation complete and integrate it with Duda.

Read on →

GSoC Status: Week 2

This week I came out with the API draft for Duda MariaDB package, it has been pushed to Github but is still under development and may be altered later. For your interest, you can refer to the repository and leave me some comments: Duda MariaDB package.

Roughly speaking, the APIs were influenced by the mariasql Node.js package and the asynchronous access code of redis. Currently there are three header files, mariadb.h contains event handling functions declaration for MariaDB connection sockets and some global definitions; connection.h contains code related to MariaDB client connections, it is responsible for connection management; query.h takes care of stuffs related to a MariaDB query, every connection can have several queries, the queries arer linked as a list and will be executed one by one.

Monkey Internals was updated this week (composed part of the scheduler section; the command line utility section was finished), the remaining sections are still under writing.

This week I also moved to my new apartment, everything got settled down and it is a nice place :D.

For the next week, I will be implementing the APIs and try to put the package into working.

Read on →

GSoC Status: Week 1

During the first week of GSoC I was investigating the APIs of MariaDB to get myself familiar with its usages. I had done several experiments with a simple MariaDB client program which includes connecting database, running queries, fetching results and preparing SQL statements.

After getting a basic understanding of the MariaDB client library, I moved on to the asynchronous APIs. There’s a post explaining how to use non-blocking interfaces with a trivial example. The non-blocking APIs are modelled after the normal blocking ones, for example the non-blocking version of mysql_real_query is a couple of functions named mysql_real_query_start and mysql_real_query_cont.

Besides the official introduction of non-blocking APIs, there’s a Node.js package mariasql that makes use of the non-blocking APIs and serves as a complete reference of writing a MariaDB driver. I am studying the source code of mariasql and the redis package of Monkey to see how I can integrate it with the Monkey’s event loop.

For the next week I will focus on designing the basic structures and functions for Monkey MariaDB package. And the unfinished blog entry discussing about Monkey intervals will continue to be updated from next week (got a lot of stuffs related to graduation recently).

Read on →

GSoC 2013 Accepted

Google Summer of Code 2013

It is such a wonderful moment when I recieved a welcome letter from Carol Smith: I was accepted by GSoC 2013 under Monkey HTTP Daemon project! Use the code, Luke! This summer is going to be awesome and unforgettable!

During the summer I will be working on Duda I/O packages which will provide support for relational databases (MariaDB/Postgresql). All the stuffs related to my project will be posted on this blog to keep the community informed.

At last I want to share some tips that might help to get your proposals accepted:

  1. choose those that suit your interest and start as early as possible.
  2. keep in touch with the community (via IRC, mailing list, etc.).
  3. get familiar with the community workflow.
  4. submit some patches to your applying projects.
  5. discuss your ideas and request some feedback.
  6. write a detailed proposal about your ideas.
Read on →

Monkey HTTP Daemon Internals

Go! Monkey!

Table of Contents

Introduction

Monkey HTTP Daemon is a web server that aims to get the most out of the Linux platform. It comes with low resource comsumption and great scalability which makes it a perfect solution for embedded devices.

Due to the compact size of Monkey’s codebase, it is a proper place for revealing the internals of a event-driven HTTP web server. Spending some time on analysing the source code of Monkey will surely worth the cost.

This post is about the internals of Monkey’s critical components from the perspective of source code, you may consider it as a supplement of this post (written by the author of Monkey). You are supposed to read it first to get a general view of Monkey.

Notice: This post is based on Monkey 1.2.0, you may want to get the latest code. (check out home page for more information). If you are using an older version, there might be something different, e.g. red-black tree is introduced since version 1.2.0.

Read on →