Miscellaneaous

Native code version

Ocsigen can be used either in bytecode or in native code (requires OCaml >= 3.11). The same configuration file can be used for both versions, but in order to use the native code version, you need to create a .cmxs file for each site or extension you want to load at startup. For example:

ocamlopt -shared -linkall -o site.cmxs site.cmxa

Note that, if your site or extension depends on external library, you also need a .cmxs for each library. If they are not included in your distribution, you may build them without recompiling the whole library. For example:

cd $(ocamlfind query sqlite3) && sudo ocamlopt -shared -linkall -o sqlite3.cmxs sqlite3.cmxa
cd $(ocamlfind query lwt) && sudo ocamlopt -shared -linkall -o lwt-react.cmxs lwt-react.cmxa

Improving performance

If you are using persistent data using Sqlite or or Dbm, for example if you are using Ocsipersist or Eliom persistent data, it is possible to improve performance by using a dedicated partition for the database (typically in directory /var/lib/ocsigen). Do not use NFS for that directory.

This is due to the fact that these databases are calling the fsync system call at each request, which is very slow on journalized file systems.

It is also not recommended (for performance) to use NFS for static pages (including user personal pages).