libuv status report

We announced back in July that with Microsoft’s support Joyent would be porting Node to Windows. This effort is ongoing but I thought it would be nice to make a status report post about the new platform library libuv which has resulted from porting Node to Windows.

libuv‘s purpose is to abstract platform-dependent code in Node into one place where it can be tested for correctness and performance before bindings to V8 are added. Since Node is totally non-blocking, libuv turns out to be a rather useful library itself: a BSD-licensed, minimal, high-performance, cross-platform networking library.

We attempt to not reinvent the wheel where possible. The entire Unix backend sits heavily on Marc Lehmann’s beautiful libraries libev and libeio. For DNS we integrated with Daniel Stenberg’s C-Ares. For cross-platform build-system support we’re relying on Chrome’s GYP meta-build system.

The current implmented features are:

  • Non-blocking TCP sockets (using IOCP on Windows)
  • Non-blocking named pipes
  • UDP
  • Timers
  • Child process spawning
  • Asynchronous DNS via c-ares or uv_getaddrinfo.
  • Asynchronous file system APIs uv_fs_*
  • High resolution time uv_hrtime
  • Current executable path look up uv_exepath
  • Thread pool scheduling uv_queue_work

The features we are working on still are

  • File system events (Currently supports inotify, ReadDirectoryChangesW and will support kqueue and event ports in the near future.) uv_fs_event_t
  • VT100 TTY uv_tty_t
  • Socket sharing between processes uv_ipc_t (planned API)

For complete documentation see the header file: include/uv.h. There are a number of tests in the test directory which demonstrate the API.

libuv supports Microsoft Windows operating systems since Windows XP SP2. It can be built with either Visual Studio or MinGW. Solaris 121 and later using GCC toolchain. Linux 2.6 or better using the GCC toolchain. Macinotsh Darwin using the GCC or XCode toolchain. It is known to work on the BSDs but we do not check the build regularly.

In addition to Node v0.5, a number of projects have begun to use libuv:

We hope to see more people contributing and using libuv in the future!

This entry was posted in Uncategorized. Bookmark the permalink.

7 Responses to libuv status report

  1. Steve Yen says:

    Hi Ryan — great work on libuv to you and team. There’s another lua wrapping of libuv that I started here: https://github.com/steveyen/uv

  2. Matt says:

    This project is really useful, thanks.

    Does libuv under Windows deal with some of the async-as-synchronous I/O corner cases that Raymond Chen describes (extending a non-sparse file or writing in the face of compression)?

    http://blogs.msdn.com/b/oldnewthing/archive/2011/09/23/10215586.aspx

    • ryandahl says:

      Currently libuv does not support overlapped file I/O. We are considering adding this in the future. For the moment it is sufficient for Node to make CRT calls in a thread pool via the uv_fs functions.

  3. Suzuki says:

    There is the one libuv related issue (https://github.com/joyent/node/issues/1697) which is causing the windows node to crash under load when using socket.io (for me, within a few minutes). Anyway, hope it is addressed soon. Other than that, hooray!

    • piscisaureus says:

      We have a patch for this already – we’re just waiting for the contributor to sign the CLA.

  4. Jona says:

    Thanks for the update! Sounds great.

    Have you heard of any progress in the ‘developing node applications with visual studio’ front? Having VS recognise commonJS commands like require() is all I really ask at this stage. Maybe debugger integration in the future.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s