Choosing a Language for High Performance Web Development
Monday, August 8, 2011 8:27:15 AM
Haskell Snap - Snap can take on a high load, but its system limited. By default the max number of file descriptor on my linux system is 1024, which is the max number of concurrent connections Snap can handle. Once you go over Snap will crash. There are ways around this, the can edit the C files needed, recompile and have something like 60,000 connections. Given that I was extremely impress with its speed, and memory usage. I did run into weird delay issues, as in they would not happen when installing the development compile on the fly version of my apps.
Scala Lift - Its running on the JVM meaning it can take a pounding, and still accept connections, while serving 200 responses. It performed a lot slower then Snap, but it wouldn’t stop. However the memory usage kept climbing up and up and up. After the benchmark was done, it stayed at that memory level, which was every nook and cranny the system had. Other then that it could handle more then 1024 connections.
Ada Aws - This really depends on who you choose to program your application. If program your app like most web apps, take a request in, compute, server then you won’t get too far with performance when dealing with a high connection rate. However if you take in a request, and quickly return the connection as taken, then the high connection rate isn’t a problem anymore. However you then need to write the responses using Ada’s tasking system, which can take a little getting use to. The end result is it can be a lot faster then snap, but you have to put a lot more effort into it. Other then that I wasn’t able to go beyond 1016 concurrent connections, which is the same issue with Snap.
Can it Comet?
Haskell Snap - No, but by default it serves as chucked data, which is how comet data is served. Snap is still a very new library and its ability to comet can certainly happen, its just not built yet.
Scala Lift - Yup. It uses an actor model to work. Even better is how you get to write it. For the most part Lift will write the html, and javascript needed. All you need to do is write the scala code. It might seem like bliss but it takes a while to even get use to actors in scala. Its code is very condense so as soon as you want to do something different it takes a some creative thinking before executing.
Ada Aws - Yup. It uses Ada’s built in tasks and their Push package. Each Push object can have many subscribers, which is no different then Lift, but how you write them really is. The draw back with AWS is that you also have to write the html and javascript by hand.
Productivity
This will go to Snap right off the back. The time it takes with Lift, even with using JRebel on a quad core system is about 5-7 seconds. Snap reloads instantly and on the page load. Ada on the other hand, is about the same time to recompile and reload the webserver. The only different is your doing that by yourself. I am sure I could right a tool to make that automatic.you have to stop the server, and restart it. AWS is by far the least productive one.
Template Language
All of these let you use any other template language. Snap steals a lot of the ideas from Lift, while AWS is really off the wall. For the most part all of these have logic-less template languages, preventing templates from looking like tag soup (ermm php). AWS does have if / if else / else, but that’s it. From a designer’s standpoint Lift is probably the best to deal with.
Language Power
All three of these languages have a small community, yet are very powerful. This is really bias as my choice is in Ada, but Haskell and Scala are both amazing languages. Ada and Haskell has a fairly small library set. However they can use any C library by wrapping them with some Ada/Haskell code. Ada is the fastest and lowest memory footprint language of them all, but the amount of code you have to write is just ridiculous, its more then any other language out there.
Haskell - Its a functional language, it doesn’t have mutable types (values that change over time) minus IO which is a weird way to get around that issue. Its very condensed, every character has deep meaning. Over all its functional aspect isn’t what sold me. What did sell me was it rich data structures, amazing type inference, and pattern matching is just magical. You save so much time because your not writing useless characters like brackets or semicolons and because the resulting code base is very small, the error rate you’d hit would be a lot lower. Lastly the fact it can be interpreted or compiled to a binary file.
Scala - Its everything Haskell is and more. It can be like java if you wanted, but you’d be dumb to do that. It can also use every Java library out there. However it took me learning Haskell to really understand the power of Scala. Until your forced to write in a functional way your benefit from Scala will be limited. Scala’s community is sky rocketing and extremely reactive.
Ada - Ada is a blocks style language. Its extremely verbose making it about the most readable languages I know. Also Gnat the compiler is one of the best compilers I’ve used. I’ve yet had a reason used the debugger. Any crash that does happen actually tells you what went wrong. Sadly Ada has about the weakest community of them all. Really the best thing about Ada for me is its real time and concurrency features, as its built into the language.
My Decision
In the end I picked Ada AWS. Haskell Snap would be my next choice. Scala’s Lift is amazing and safe but it really got in my way. I don’t mean limited in the sense of features, but rather along the lines of Django. It’s a very very high level library, so wanting to start at a lower level means you have to understand the in’s and out’s of Lift’s libraries first. On top of that I’m using a server with a limited amount of memory. AWS and Snap both fit in that range, not Scala. If I had the time to learn Lift, I’d go with lift anyways. It feels a little like Google Web Toolkit, but much more leaned back and lot less push on using their GUI, right now Lift really only does the menu for you.

