Upload
anil-madhavapeddy
View
1.199
Download
1
Embed Size (px)
DESCRIPTION
We present a case-study of using OCaml within a large product development project, focussing on both the technical and non- technical issues that arose as a result. We draw comparisons between the OCaml team and the other teams that worked on the project, providing comparative data on hiring patterns and cross-team code contribution.
Citation preview
USING FUNCTIONAL
PROGRAMMING WITHIN AN
INDUSTRIAL PRODUCT
GROUP: PERSPECTIVES AND
PERCEPTIONS
David Scott Citrix Systems
Richard Sharp Citrix Systems
ThomasGazagnaire INRIA
Anil Madhavapeddy University of
Cambridge
presenter
XenServer: an operating system virtualisation
platform
Why is XenServer interesting?
It is widely distributed
50k companies; largest customer >20k physical
machines
It is low-level mission-critical infrastructure
Hypervisor, kernel, management stack, Windows GUI
It is written in C,OCaml, Python, C#
Around 11 full-timeOCamldevs; 130kLOC
ofOCaml
About Us
Why did we chooseOCaml?
Several of us used it before and trusted it.
We believed it would make us more
productive.
As a startup, there was a culture of risk-
taking and innovation.
… and no-one was able to stop us
A mix of programming styles
Imperative Most I/O, Xen and OS syscalls. “A type-safe C”
Functional Bin packing algorithms for failure planning
Combinators for domain communicationwait_for (
any_of
[ „OK, value_to_appear “/path1”;
„Failed, value_to_become "/path" v
] )
Meta Programming Database accessors, RPC stubs, API specification
What (some) people said
“the tool-chain is not mature enough”
“we will not be able to hireOCamlpeople”
“no-one will buy the company”
“people in other teams will not be able to
contribute any code”
“the tool-chain is not mature
enough”
In 4.5 years of heavy use, we found one
(obscure) compiler bug
It was already fixed in CVS when we reported it
The binaries are subjected to 2,000 machine-
hours of testing every night, with regular week-
long soak stress tests
Last seg-fault was over 3 years ago
There was a missing “%s” in our custom C
bindings
… and an extra “%s” in some Python code
“we will not be able to
hireOCamlpeople”
FromOctober 2006 –April 2010, 12OCaml
engineers hired (25% of engineering hires, as
planned)
Only 2 had previousOCamlexperience
Training time was dominated by learning the
product, not the language
Advertising on caml-list, haskell-café got great
candidates
“no-one will buy the company”
Argument: in the due-diligence phase, a
suitor will detect the presence of a “non-
standard” “research” langage likeOCamland
conclude we‟re not serious
Reality: on 22nd October 2007, Citrix paid
$500M for XenSource after a comprehensive
code review.
“people in other teams will not be
able to contribute any code”
“… what about contribution
size”
Concerns
Foreign Function Interface
Requires much knowledge of the GC, and bugs
can be subtle. But we like how fast it is!
Profiling support
More of a generic UNIX issue, but interactions of
threads, process and hypercalls can be
“interesting”.
Conclusion
We‟re very happy withOCaml !
Great tools
Nice language
Excellent people
Our code is open-source (LGPL), check it out:
http://www.xen.org/products/cloudxen.html
Questions?