by darklajid · 14y ago · 0 comments
As soon as you remove the startup time from the equation (by stopping to spawn a tool per request) the result is really just IO (writing a couple headers, serving a file) which _should_ perform quite similar in most applicable languages.
While I'd like to see more (practical) Haskell content, this seems to be a lot of reinvention (see for example the mime-table commits). Whatever the language ended up being, was there no way to solve that issue more easily (and arguably, cleaner)?
FastCGI static-cat should work (indeed, one of the original design intents was making this switch easy, if we decided to do it). But I disagree that language becomes irrelevant in this case: you still care about memory usage (since this will influence how many users you can support) and loading an entire interpreter can be pretty costly. I do agree that IO should be essentially comparable.
As for the reinvention, all of these features are what you would normally find in Apache. But Apache is a large, complicated piece of software, and we don't want it to have access to arbitrary user files if it is compromised.
Interpreter: Sure. I've no clue how many concurrent users you have (or is that the 4000 above?) - at some point that becomes a good point again.
Anyway: Thanks a lot, appreciated the feedback directly from the source. :)
http://andersk.mit.edu/gitweb/scripts-static-cat.git/blob_pl...
The alternative to reinvention is usually borrowing other people's code, and it's often not clear that this will increase confidence in the correctness of the code.
What I take from this post is a reminder that efficiency worries need not deter one from using languages like Haskell for this kind of task, despite the widespread belief that "CGI programs have to be small". The example would be that bit more compelling if the authors had used Quick Check to partly specify the code.