[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ocaml-dns

On 17 Mar 2013, at 09:52, Anastasia Gornostaeva <ermine@xxxxxxxx> wrote:

> On Sat, Mar 16, 2013 at 04:37:43PM -0500, Anil Madhavapeddy wrote:
>> implement that in pure OCaml.
>> Let us know if you run into any problems (the library's still beta, so
>> we can break interfaces if needed before a 1.0 release).
> ocamlfind: Package `ocplib-endian' not found - required by `cstruct'
> ocamlfind: Package `optcomp' not found - required by `ocplib-endian'
> Error: Unbound module Re_str

ocplib-endian is a library which implements integer marshalling/unmarshal
support into Bigarray.  OCaml-4.01.0 and higher support compiler primitives
which eliminate a lot of intermediate boxing, and hence perform better.

optcomp provides #if preprocessor support to detect the right compiler
version, and fall back to the slower manual functions on older compilers.

cstruct provides the syntax extension that's analogous to Bitstring,
except that it works directly on Bigarray and avoids copies.  Performance
is higher as a result (note that Cstruct doesn't currently do much of
the static analysis that Bitstring does, so it can get even better with
some more effort).

> $ ... install (outside of opam)
> W: Cannot find source header for module Zone_lexer in library dns
> W: Cannot find source header for module Zone_parser in library dns
> ocamlfind: Package dns is already installed
> - (file /home/ermine/.opam/system/lib/dns/META already exists)

Presumably this is because you've already installed a DNS package? 
OCamlfind doesn't let you keep multiple installations with the same name,
so remove the old one first.

> So many strange dependences!

They're only strange until you know what they're for :-)  OPAM takes care
of all this for you, so it's not really an issue any more.  We've been
working on improving *BSD compatibility there, btw, so it should be better
than it used to be.

However, it looks from your example above that you already used OPAM to
install it, so it's a bit of a mystery to me why you didn't have the
dependencies installed:

depends: ["lwt" {>="2.4.1"} "cstruct" {>="0.6.0"} "ocamlfind" 
           "cryptokit" "re" "uri" "cmdliner" ]

> Looking at github.com/ygrek/yadns - it requeres only bitstring to parse
> dns stuff.

Sure... if you don't mind Bitstring copying into OCaml strings, then it's
more straightforward (we used to use it in ocaml-dns also). The Mirage DNS 
(and the rest of the stack) tries to minimise data copies, as it also has to
append the UDP/Ethernet headers after it assembles a packet.

Using OCaml strings locks you into a world where you have more heap and GC
pressure, and then you're stuck at a certain level of performance forever...




Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.