On Tue, Jul 21, 2009 at 10:14 AM, rob<r.p.l...@gmail.com> wrote: > > It sounds like you want to avoid the approach of Apache Tomcat and > Clojure servelets (why not do it that way by the way?) CGI allows you > to operate any program via the web, but it will be alot slower if you > have load everything every time a request is received by the server. > My guess is that it will be prohibitively clunky. I saw a good > article on using emacs lisp via CGI, which if that is what you want to > do, makes sense as the way to do it since there is no other more > integrated way (in contrast with Java which is used for server-side > web application development all the time). You could use that article > to learn about CGI, but there's really not much to it. > > There may be some way of keeping Clojure running and thereby avoiding > that overhead. This would be similar to if there were a "mod_clojure" > for Apache, except mod_clojure (or mod_java-- which really does exist) > should allow you greater access and control at the various stages of > the request and serving of content. I have not tried using servelets, > so I'm not certain what the advantages/ disadvantages are. Mod_java > is less developed and has had less people working on it and using it > than Tomcat/ servelets, but I don't know much about either really, and > have no personal experiences with either of these approaches. >
I mostly agree with the above, just to extend it a bit: PHP is an interpreter which means a new process is fired up on every request. Java is abysmally slow if you try to use it in the same way since you have to instantiate the whole VM everytime (besides the fact that you have to serialize all state incl. caches to disk to survive a request). What you need is a resident JVM process to answer your requests. If you're using Apache in front to handle the requests you can use more than one strategy, there should be enough tutorials around to help you with that (start at http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html to get an idea). This is quite a bit different from PHP, but also Rails etc. usually have a resident process that you're talking to (FastCGI etc.). It makes some other things in the end a lot easier. If you try to just have something small up and running without a lot of hassle, try to make it on Google App Engine. There you have a (restricted) managed JVM and you just have to supply a servlet (standard API for writing HTTP handler in Java land). Otherwise, there are a few companies that have JVM hosting in Virtual machines on offer (e.g. Kattare: http://www.kattare.com/). Rant: I also find it annoying and unnecessarily complex to have JVM based webapplications running online. Not many managed JVM environments are available in comparison to PHP, Python, Perl, Ruby, et al. The reason is that until now it's still not really possible to reliably partition applications (code, resources consumption, kill of only one applicaton) within a single JVM, that means, JVM don't really mix with shared hosting plans (the solutions are so called MVMs with true separation of resources inside a JVM). Until these MVMs arrive, you really need are Hypervisor based solutions, Xen etc. to constrain ressource usage. I hope that someone is going to tackle that problem soon, there's a pile of cash waiting to be made if you can pull it off for the masses. Hope that helps. Cheers, Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---