facil.io v0.6.0.dev Release Notes
-
๐ This is a major release, changing much of the extension API (HTTP, pub/sub, CLI) and some of the core API (i.e., moving the
evio
polling to One-Shot polling).Migration isn't difficult, but is not transparent either.
๐ Fix (backported): (
websocket_parser
) The websocket parser had a memory offset and alignment handling issue in it's unmasking (XOR) logic and the new memory alignment protection code. The issue would impact the parser in rare occasions when multiple messages where pipelined in the internal buffer and their length produced an odd alignment (the issue would occur with very fast clients, or a very stressed server).๐ Note About Fixes:
- ๐ I simply rewrote much of the code to know if the issues I fixed were present in the 0.5.x version or not.
I believe some things work better. Some of the locking concerns will have less contention and I think I fixed some issues in the
fiobj
core types as well as thehttp
extension.However, experience tells me a new major release (0.6.0) is always more fragile than a patch release. I did my best to test the new code, but experience tells me my tests are often as buggy as the code they test.
Anyway, I'm releasing 0.6.0 knowing it works better than the 0.5.8 version, but also knowing it wasn't battle tested just yet.
๐ Changes!: (
fiobj
/ facil.io objects):Major API changes.
The facil.io dynamic type library moved closer to facil.io's core, integrating itself into the HTTP request/response handling, the Pub/Sub engine, the Websocket internal buffer and practically every aspect of the library.
This required some simplification of the
fiobj
and making sure future changes would require less of a migration process.๐ The Symbol and Couplet types were removed, along with nesting protection support (which nobody seemed to use anyway).
๐ We're back to static typing with
enum
, using macros and inline functions for type identification (better performance at the expense of making extendability somewhat harder).๐ Hashes are now 100% collision resistant and have improved memory locality, at the expense of using more memory and performing calling
memcmp
(this can be avoided when seeking / removing / deleting items, but not when overwriting items).
๐ Changes!: (
http
):๐ The HTTP API and engine was completely re-written (except the HTTP/1.1 parser), both to support future client mode (including chunked encoding for trailing headers) and to make routing and request parsing easier.
๐ The updates to the HTTP API might result in decreased performance during the HTTP request reading due to the need to allocate resources and possibly copy some of the data into dynamic storage... For example, header Hash Tables replaced header Arrays, improving lookup times and increasing creation time.
๐ The HTTP parser now breaks down long URI schemes into a short URI +
host
header (which might become an array if it's included anyway).
๐ Changes!: (
websocket
):The Websocket API includes numerous breaking changes, not least is the pub/sub API rewrite that now leverages
FIOBJ
Strings / Symbols.websocket_write_each
was deprecated (favoring a pub/sub only design).
๐ Changes!: (
pubsub
):The
pubsub
API was redesigned after re-evaluating the function of a pub/sub engine and in order to take advantage of theFIOBJ
type system.๐ Channel names now use a hash map with collision protection (using
memcmp
to compare channel names). The means that the 4 but trie is no longer in use and will be deprecated.
๐ Changes!: (
redis
):- ๐ The
redis_engine
was rewritten, along with the RESP parser, to reflect the changes in the newpubsub
service and to remove obsolete code.
๐ Changes!: (
facil
):Slight API changes:
facil_last_tick
now returnsstruct timespec
instead oftime_t
, allowing for more accurate time stamping.facil_cluster_send
andfacil_cluster_set_handler
were redesigned to reflect the new cluster engine (now using Unix Sockets instead of pipes).
โก๏ธ Internal updates to accommodate changes to other libraries.
๐ท Cluster mode now behaves as sentinel, re-spawning any crashed worker processes (except in DEBUG mode).
๐ Changes!: (
evio
):the evented IO library was redesigned for one-shot notifications, requiring a call to
evio_add
orevio_set_timer
in order to receive future notifications.This was a significant change in behavior and the changes to the API (causing backwards incompatibility) were intentional.
๐จ the code was refactored to separate system specific logic into different files. making it easier to support more systems in the future.
๐ Changes!: (
sock
):๐ the socket library now supports automatic Unix detection (set
port
to NULL and provide a valid Unix socket path in theaddress
field).๐จ the socket library's Read/Write hooks API was revised, separating the function pointers from the user data. At server loads over 25%, this decreases the memory footprint.
๐ the socket library's packet buffer API was deprecated and all
sock_write2(...)
operations take ownership of the memory/file (enforcemove
).โก๏ธ The internal engine was updated, removing pre-allocated packet buffers altogether and enabling packet header allocation using
malloc
, which introduces a significant changes to the internal behavior, possibly effecting embedded systems.
๐ Changes!: (
defer
):โ Removed forking from the defer library, moving the
fork
logic into the mainfacil
source code.โฑ Defer thread pools and now include two weak functions that allow for customized thread scheduling (wakeup/wait). These are overwritten by facil.io (in
facil.c
).By default, defer will use
nanosleep
.
๐จ Refactoring: (
fiobj
) moved the underlying Dynamic Array and Hash Table logic into single file libraries that supportvoid *
pointers, allowing the same logic to be used for any C object collection (as well as the facil.io objects).