8 ms·
My Company Is Using OCaml for web development. Why?
- pestaa 16y agoIs it down for me only?
- VMG 16y agoalso down here
- victorNicollet 16y agoNo, y'all managed to kill me server >_< I'll try to bring it back from the dead. EDIT: it's back (or at least, looks like it). The traffic is being drained to a static copy of the page, so don't be surprised if comments you post on that page don't appear. I'll be back with an actual (cache-based) solution soon, hopefully.
- heresy 16y agoCaching!
- marceldegraaf 16y agoI couldn't resist asking: is the article hosted by an OCaml application? ;-)
- victorNicollet 16y agoInteresting question :P, but no: it's a vanilla 3.0.x Wordpress on a RPS server. The performance issue appears to be the server swapping like mad.
- bradleyland 16y agohttp://wordpress.org/extend/plugins/wp-super-cache/ http://wordpress.org/extend/plugins/wp-super-cache/ http://rimuhosting.com/howto/memory.jsp http://rimuhosting.com/howto/memory.jsp Scroll down to RESOLVING: HIGH APACHE MEMORY USAGE EDIT: I realized after I posted that simply posting two links might seem snarky. I don't mean to be. I know these links because I've been in the same spot you are. I think we all have. That's how we learn :)
- victorNicollet 16y agoThanks for the links, I actually applied the second one on my own, without much success. Right now, I'm looking at a server with no swapping, normal memory usage, low processor usage, no IOwait, but serving HTTP requests at the speed of a dead snail nailed to an ice cube. I'll try to install the cache plugin as soon as I retrieve control over my server.
- bradleyland 16y agoTo get a picture of what's going on, try logging in to your shell and install htop. It's a great little utility that shows you load averages, memory usage (broken down in to used, buffered, and cached memory in real time. Very handy.
- steveklabnik 16y agoAdding on to bradleyland's advice: http://www.kalzumeus.com/2010/06/19/running-apache-on-a-memory-constrained-vps/ http://www.kalzumeus.com/2010/06/19/running-apache-on-a-memo...
- sambeau 16y agoMight I take this opportunity to recommend: http://www.cherokee-project.com/ http://www.cherokee-project.com/ as close as you'll get to Zeus Web Server for free.
- beaumartinez 16y agohttp://www.downforeveryoneorjustme.com/www.nicollet.net http://www.downforeveryoneorjustme.com/www.nicollet.net
- savoy11 16y agoBecause you are a stupid nerd. Does this qualify for a valid answer in your book?
- savoy11 16y agoOh. And the site does not work. Next time you choose a stupid non-web technology to power your WEB site, do it in a way that makes it work. That is kinda important.
- gchucky 16y agoIt's been cached at http://www.nicollet.net.nyud.net/2011/02/objective-caml-web-programming/ http://www.nicollet.net.nyud.net/2011/02/objective-caml-web-...
- deno 16y agoReally? I get 408 Timeouts. Anyway you can access it at: http://webcache.googleusercontent.com/search?q=cache:http://www.nicollet.net/2011/02/objective-caml-web-programming/&hl=en&strip=1 http://webcache.googleusercontent.com/search?q=cache:http://... as well. And I believe OP is working on bringing the site back online.
- gchucky 16y agoJust after posting that link it stopped working for me. Strange.But yeah, your cache link is better.
- deno 16y agoNetwork creators admit[1] that the architecture of CoralCDN isn't very well suited for supporting content availability (as opposed to helping with handling load & bandwidth usage). For example, at any point in time, content can be removed from cache—before completing its usual 24h lifecycle—to accommodate resource usage for different sites. [1] "Experiences with CoralCDN: A Five-Year Operational View" http://www.coralcdn.org/docs/coral-nsdi10.pdf http://www.coralcdn.org/docs/coral-nsdi10.pdf
- kunalb 16y agoI've been looking into Haskell for web development—in particular, the snap framework. Did you consider using other functional languages before choosing OCaml, as in does OCaml have any specific advantages for web dev?
- victorNicollet 16y agoI wish I could say the choice of OCaml among all available functional languages was objective, rational and well-deserved... the fundamental reason is that my knowledge of OCaml is orders of magnitude greater than my knowledge of Haskell, F# or Erlang (three languages I would have considered using as well). I do find OCaml more adapted to the way I think, but the way I think probably ended up the way it is because I have been using OCaml a lot. I can do a fairly adequate analysis of OCaml-versus-PHP or OCaml-versus-C# because I'm familiar with both sides of the equation, but I wouldn't be able to do an honest comparison of OCaml and Haskell.
- gtani 16y agothese ask reddit's are pretty good. Good Lang A vs B comp's are very rare. http://www.reddit.com/r/ocaml/comments/fmpl8/i_have_yet_to_learn_a_functional_programming/ http://www.reddit.com/r/ocaml/comments/fmpl8/i_have_yet_to_l... http://www.reddit.com/r/haskell/comments/fmp66/i_have_yet_to_learn_a_functional_programming/ http://www.reddit.com/r/haskell/comments/fmp66/i_have_yet_to... and this guy's universe of FP languages: http://www.slideshare.net/brweber2/functional-concepts-for-oop-developers-presentation http://www.slideshare.net/brweber2/functional-concepts-for-o... slide 12: haskell, clean, F#, ML/ocaml, lisp, scheme, scala, clojure, erlang, XSLT
- VMG 16y agoChosing one language over the other because you know it better is rational and well-deserved.
- deno 16y agoIt seems to me that strongly-typed languages—functional or not—are going to make a strong comeback to web development. The current trend is to narrow down your webapp to a REST[ful] API. Any HTML you generate is only to bootstrap your client-side application (and load initial state) and to accommodate non-JS-enabled clients, which in this date and age should only mean search engine spiders. The advantage is a uniform interface, like a file-descriptor in Plan-9 (an analogy used in latest InfoQ interview with GO/Newsqueak creator), the HTTP protocol. And for that, languages like OCaml or Haskell should flourish. Especially functional languages, since typical REST API request should be nothing but data+auth token (whether that's cookie or oauth token). Applications developed in that model—besides being much simpler to write and test—are easily cacheable and more secure by default. The added bonus is that object oriented languages, that have been most successful in GUI programming, can be once again utilized purely for that. If not embracing this model one is left with little appealing options: 1) continue to process text in perl-like manner with RoR/Django/etc., coping with nondeterministic behavior and security 2) to invest in frameworks that hide HTTP at all, coding to widgets instead of pages, and to let framework decide how to push that over the wire, which usually means that some sort of continuations are employed, which are inherently HTTP-unfriendly and uncacheable outside of the app's context 3) to replace HTTP with something else, probably some sort of RPC
- thesz 16y agoI think they are strong anywhere you need dependable core of the system. I see it as a trend, actually, statically typed languages grew stronger in various fields, from operating system kernels [1] to web development and shell scripting [2]. [1] http://www.ok-labs.com/ http://www.ok-labs.com/ [2] http://lambda-the-ultimate.org/node/4197 http://lambda-the-ultimate.org/node/4197
- rickmode 16y agoCorrect me if I'm wrong but it seems you mean "statically typed" instead of "strongly typed". PHP is weakly typed. Common Lisp, Clojure, Haskell and OCaml are strongly typed. PHP is dynamically typed, Haskell and OCaml are statically typed. That said I would like to learn more about these statically typed functional languages.
- djb_hackernews 16y agoTake the opportunity to learn OCaml, then in a year go make the big bucks on Wall Street implementing trading systems for hedge funds.
- MichaelGG 16y agoI'm curious as to the hiring implications. Certainly the harder part is finding programmers capable of dealing with functional programming, not the specific language? And wouldn't advertising OCaml (or Haskell) be a way to get talented folks quickly? It seems a lot of such programmers wish they could have a job where they get to use a decent language.
- Nate75Sanders 16y agoJane Street Capital has mentioned that their use of OCaml has been a great instrument for separating the wheat from the chaff.
- primodemus 16y agoAccording to Yaron Minsky (Jane Street Capital), yes: "One of the things we noticed very quickly when we started hiring people to program in OCaml was that the average quality of applicants we saw was much higher than what we saw when trying to hire, say, Java programmers. It’s not that there are not really talented Java programmers out there, there are. It is just that for us, finding them was much harder. The density of bright people in the OCaml community is impressive and it shows up in hiring, when reading the OCaml mailing list, and when reading the software written by people in the community. That pool of talent is probably the single best thing about OCaml from our point of view". More: http://www.janestreetcapital.com/minsky_weeks-jfp_18.pdf http://www.janestreetcapital.com/minsky_weeks-jfp_18.pdf
- rgoddard 16y agoSeems like the same phenomenon described in the python paradox essay: http://www.paulgraham.com/pypar.html http://www.paulgraham.com/pypar.html
- foljs 16y agoBecause they are interested in using what's considered geek-cool instead of the right tools for the job?
- pnathan 16y agoThere are two basic reasons I would select an 'advanced' language for development. 1 - can express 'weird' things that other languages would not be able necessarily express without strange gyrations. 2 - if you can develop in it, you're probably on the upper half of the developer bell curve. That brings systemic improvements in general.
- victorNicollet 16y agoFrom my experience, PHP can be as expressive as OCaml in the hands of an expert - in different ways, of course, but the end result should be fairly similar in terms of size. The problem is that PHP achieves this by throwing any kind of compile-time safety (and any kind of compile time, for that matter) to the wind. It's doing the equivalent of running around naked and shouting "I'm invisible". So, most of the time, you end up with a piece of software that's short and sweet and hopelessly brittle.
- kenjackson 16y agoif you can develop in it, you're probably on the upper half of the developer bell curve. That brings systemic improvements in general. Why hasn't this happened? Preumably if you use an advanced language you'll be a lot more productive because of the language and because you have the best developers. Why haven't we seen shops that use advanced languages just utterly clean up? "Oh, you're doing 30fps with 1m vertices -- we just did 90fps with 50m vertices -- and btw, we did this w/o using the GPU". Or "Chrome? We built a new web browser that supports every draft of every aspect of HTML5, w/ a Javascript parser that runs at twice the speed of Chrome, and we wrote a new H264/WebM codec that doesn't require a GPU and can do HD video on a 286". It just seems like for all the advantages that using an advanced language presumably gives, the software I see is simply "competitive". Maybe it will be the best in some spaces, but within the range that one would expect the best to be if everyone used C, for example. And even among those who know these advanced languages really well, we don't see them fighting for them in their organization the way one might think given all they should presumably provide. Think Norvig, Steele, Abelson, Meijer, etc...
- technomancy 16y ago
- fleitz 16y agoIf you're using OCaml for webdev, may I ask why you chose that over F# + ASP.NET?
- SkyMarshal 16y agoPrefer a FOSS stack to the MS platform, to get the obvious out of the way.
- gregwebs 16y agoGreat article! I program Rails by day, but lately have been working with the haskell Yesod framework: http://docs.yesodweb.com/book/basics http://docs.yesodweb.com/book/basics. It even has type-safe urls. I would disagree that lack of popularity of language is not a technical problem- it is because there is less community code available.