This week all of lib was merged in master. I also did some fresh coding, mainly inlining the most often called small functions.
Most of the non-lib-related changes have been merged. It came up that Sonny has a fcgi plugin already running, so to avoid duplicating work, I’ll wait a bit for it to be released.
Merging the changes from lib was started, and several hundred lines are already in master. Next week this effort will continue.
FCGI may or may not start next week, as it took longer to review the first patches from last week, and I’d like to have most of lib ready in master before starting fcgi.
I was traveling this week, so no actual development.
The first set of the lib branch was sent to the ML mid-week, but has not been reviewed yet. The next week will consist of mainlining the lib branch and cleanups as far as possible.
Not much this week. The HTTP 1.1 chunked encoding patch was merged, and the CGI plugin was disabled on Android.
This week there were tweaks to the CGI plugin.
It now supports per-vhost configuration (merged) and HTTP 1.1 chunked encoding (still on list).
Next week is about the mid-gsoc review and starting the merge of lib.
How to test libMonkey
- Clone the lib branch from github:
git clone https://github.com/clbr/monkey.git cd monkey git checkout -b lib origin/lib
./configure --prefix=/usr/local --enable-shared # Use your desired prefix and other path changes
make && sudo make install
To build any app that uses libmonkey, you can use pkg-config. “pkg-config –cflags monkey” will output the cflags needed, and “pkg-config –libs monkey” will output the linking line.
For example, here’s how to build hello.c in examples/:
cd examples gcc -o hello hello.c `pkg-config --cflags --libs monkey`
Some 30 commits.
Not much happened this week. I have cleaned up the globals some more.
The cleanups are waiting for the previous ones to be reviewed, and how to handle a high-load failure in the CGI plugin was discussed. The CGI plugin in master is now stable.
Next week, the CGI plugin will see more work, and cleanups will be sent when possible. The CGI plugin will get support for per-vhost matching and HTTP 1.1 chunked encoding; header filtering is still being discussed. Mid-term evaluations will also start, ending on 9-13 July.
104 commits this week.
Lib had some small general cleanup. I did a bigger overhaul with the global variables, which dropped the plugins’ sizes again among other benefits (more security from const data being marked const, faster startup due to no need to initialize static data with code). The CGI plugin was moved from a blocking model to an event-based model.
With the globals now moved out of the headers, many were found to be unused, and they no longer pollute the plugins either. Before this each plugin “inherited” a couple dozen global variables it did not use, enlarging it unnecessarily.
For the CGI event benchmarks, see the previous post. Note that current master is not stable with the event-based CGI, as the patch to avoid closing an already-closed connection is not yet applied. There’s some discussion whether it should be implemented some other way.
The CGI plugin was initially blocking, because that was the easiest way to write it. This week I’ve so far worked on moving it to the event-based model.
Initial results were terrible, while I could get it stable, its performance was only 50-60% of that of the blocking model, latency was doubled, and it came with 250 more lines of code.
Today, investigating showed that epoll was firing some 2k pointless write events when we had nothing to write. The couple additional syscalls to remove the wait for write events when we know we don’t need them were quite a win.
The latest CGI plugin is event-based, stable, and better than the blocking one, not counting lines of code though (they increased to 300 ;)).
Performance increased 18% for shell scripts, 88% for the C app, and 26% for PHP. Latency is less than half of the blocking model’s one, it’s sub-10ms now (vs 15-20ms).
For comparison, static pages get 29k on the same setup.