Hacker News new | past | comments | ask | show | jobs | submit | avsm's comments login

Peertube has been a fantastic way to mirror videos from Youtube and have embedded versions that are ad- and cookie-free. It's got support for mirroring channels from the other video providers which makes it a breeze to run. I've deployed it for various communities:

- https://watch.ocaml.org (for all the OCaml language talks over the past 20 years)

- https://watch.eeg.cl.cam.ac.uk (for our research group on environmental science)

- https://crank.recoil.org (for my personal talks and videos)

The fediverse integration is a minor plus, but the permanent nature of the video hosting. My only wish is that there was a way to bidirectionally mirror view counts, so that the Peertube mirrors don't look like a ghost town.


There was a Commercial Uses of Functional Programming workshop talk back in 2009 where the engineers behind Facebook Chat talked about their use of Erlang.

http://cufp.org/2009/functional-programming-facebook.html

The abstract covers the pros and cons behind using Erlang back then pretty well.


this is great, thank you


Effects are included in OCaml 5, but considered experimental. This doesn't stop us from building libraries that take advantage of them internally, in order to provide really nice external interfaces.

The best developed one is "eio", which uses effects (and io_uring on Linux) internally in order to provide a really high performance, direct-style IO library for OCaml. You can walk through some of the code here: https://github.com/ocaml-multicore/eio#getting-started

Also a video talk about our experiences with using effects for writing parsers, from the OCaml Workshop last year. https://watch.ocaml.org/videos/watch/74ece0a8-380f-4e2a-bef5...


The libraries are embedded in quite a few places; for example it's used in every single Docker for Desktop instance:

- https://mirage.io/blog/2022-04-06.vpnkit

- https://www.youtube.com/watch?v=zqFDEDl5Zes

- https://github.com/moby/vpnkit

- https://speakerdeck.com/avsm/the-functional-innards-of-docke...

And then there are deployments in QubesOS, Xen, Nitrokey, etc. Bear in mind that MirageOS is a library OS, which doesn't just mean "compile to a standalone kernel instance". It just means that it can be linked into all sorts of embedded environments, some of which are the solo5 or Xen backends you see in talks.

More on the Mirage blog: https://mirage.io/blog


This all started because we wanted to _get away_ from the need to fork or run multiple processes, since that's so hard in a variety of hardware architectures (like mobile or embedded).

Other researchers also share the dislike of fork... https://www.microsoft.com/en-us/research/uploads/prod/2019/0...

A 2010 paper where I sketched out some of the early ideas around "multiscale" is here: https://anil.recoil.org/papers/2010-bcs-visions.pdf

It took a little longer than I'd planned, but thanks to the hard work of so many MirageOS contributors, now's a pretty good time to glue back personal containers and self-hosted data management infrastructure again! Unikernel-based messaging has really come together in the past couple of years: https://tarides.com/blog/2022-03-08-secure-virtual-messages-...


Just substitute 'microservice' with 'unikernel' and you do broadly the same things. There's a prometheus library that you link with the MirageOS unikernel and it exports using that: https://github.com/mirage/prometheus

No FAQ for this sort of thing yet, but we should start assembling one sometime soon. Questions like this very welcome on the discussion forums: https://discuss.ocaml.org/t/ann-mirageos-4-0/9598 to help us get started.

There's a nice collection of unikernels over at: https://github.com/roburio/unikernels and https://github.com/tarides/unikernels for various infrastructure pieces (like https, smtp, dns, ip filters, etc) that are good to crib from for your own infrastructure.


work has already begin on a direct-style IO library that internally uses effects. See:

- https://github.com/ocaml-multicore/eio#readme for more information on the Eio library - https://watch.ocaml.org/videos/watch/74ece0a8-380f-4e2a-bef5... is a short talk on experiences using effects with some nice motivating examples

Note that Eio is more than just a direct replacement for Lwt and Async. We couldn't resist using some of the experiences also gained from the MirageOS (mirage.io) unikernel framework in EIO. This means that the backends are highly optimised to use the best syscalls available in the OS (e.g. io_uring by default in Linux). If you write your applications to use Eio natively, then performance is very high so far. The ergonomics of programming in it also compare favourably to using monadic concurrency.


so EIO is a new IO implementation built on top of effect handlers? Will EIO also be part of the stdlib?

ie. will the httpaf server library need to import it as an external dependency like it currently does with lwt, or will EIO already be available?


I just lurk the OCaml forums so don't take what I say as gospel but from what I've understood EIO will _not_ be part of stdlib. The OCaml devs go out of their way to not break things in stdlib so from what I've gathered they don't want to include it EIO until there's more real world experience with it and the API has started to settle down. Including it in stdlib might also never happen but that remains to be seen.


It's too early to say. Eio is still under very active development, so we'll have to see how it goes. The more useful feedback we get on it now, the more likely it'll be submitted for consideration in the OCaml stdlib when appropriate.


(co-author of the OCaml memory model paper here)

The details of the 'LDRF' (local data race freedom) property are described in detail here: https://anil.recoil.org/papers/2018-pldi-memorymodel.pdf

The performance numbers are in the paper abstract: "our evaluation demonstrates that it is possible to balance a comprehensible memory model with a reasonable (no overhead on x86, ~0.6% on ARM) sequential performance trade-off in a mainstream programming language". It's a little higher on PowerPC but still very usable, and RISC-V overheads should be roughly comparable to ARM.


As the paper clarifies, this is for the performance of non-atomic read/writes in sequential setting. The paper left the performance evaluation for atomic read/writes to future work. Is there any indication yet regarding the performance in a parallel setting compared to weaker guarantees?


That's right -- we first wanted to establish that existing OCaml code wouldn't be adversely impacted. There are various efforts ongoing to build interested (locked and lock-free) concurrent data structures, so that will inform the parallel performance results. Nothing published yet.


Does this feature inhibit any kind of optimization that current compilers could perform?


According to the paper “any compiler optimisation that breaks the load-to-store ordering is disallowed.”


(Coauthor of RWO here)

We are just finishing edits of a few chapters (the tooling, testing and GADT ones), and then it’ll be off to the publishers early in the new year. The online one is therefore pretty up to date.

There’s also a thread on the OCaml forums on this topic with more suggestions: https://discuss.ocaml.org/t/how-do-you-stay-productive-in-oc...


since you're here, what do you think about starting a new OCaml project with esy as best practice today? I was working on https://o1-labs.github.io/ocamlbyexample/ and I was thinking of starting with that approach as it seems to provide a more modern experience than just opam/dune. (I read your book as introduction to OCaml and still struggled a ton with all the edge-cases of dune and opam. Even today I'm iffy every time I start working on some OCaml code again because I know I'll have to deal with opam/dune issues.)


Thanks a bunch!


You may find the “nnpchecker” configure option in 4.13.0 useful. This will print a detected use of naked pointers to stderr, which can hopefully be triggered by test suites.

Noalloc and registering roots should all be the same, as are callbacks (for sequential code, which all existing code will be)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: