Nleyten@1400: Netplexing


The Ocamlnet set of libraries ranks among the many gems available for Ocaml. The blurb on the project's page describes it this way:

Ocamlnet implements a number of Internet protocols (http client & server, cgi and cgi variants, SunRPC, FTP, POP, SMTP) and is a strong base for web and Internet programming. Many protocols can even be driven in an asychronous way, since Ocamlnet defines a framework for asynchronous implementations (equeue). There is also a generic server framework (netplex). There are a number of accompanying data structures like mail messages, URLs, buffers, channels, and also routines for character set conversions.

Netplex is of particular interest for me at the moment. It is basically a generic server framework, allowing one to build full-fledged servers with very little effort. If you've ever built a server from scratch, you will know that while building a basic server is relatively straightforward, things start to get complicated if you intend to move from a simple toy into a production-quality application. Pretty soon you'll start having to worry about keeping pools of slave workers, managing the workload, and synchronising the entire apparatus. Netplex takes care of all of that stuff for you. The end result is that you get an efficient, secure, and fully-featured server with just a few lines of code.

I am using Netplex to build a "parsing server" (aka the 'Parserver'). It is basically a little daemon that sits in the background providing a service that translates a document formatted in one of the supported markups (like Lambtex) into the native representation used by Lambdium. Placing this service in an external, independent daemon makes sense for a number of reasons:

  1. it makes the system more scalable, since we can easily move the parsing server into its own machine(s) if necessary.
  2. it makes the system more secure, since the parsing daemon can run as 'nobody' as shield the rest of the system from potential attacks based from the parsing routines.
  3. Applications built using the Ocsigen framework should be built using the Lwt library for cooperative threads (Lwt stands for 'Lightweight Threads'). At the present no parser-generator includes support for Lwt. It does make sense therefore to place the parsing outside the main application.

As for SVN's 1400 revision log itself, it reads "Defined the protocol for communication with Parserver".

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments

Leave a comment

Submitted comments are subject to moderation before being displayed.

 Enter the above security code (required)

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.