by christophilus · 4y ago · 0 comments
I’d love to use Clojure for this, but it doesn’t seem well suited to running in a small, shared environment. Or is it now that there’s AOT?
> An easy to use, drop-in Clojure replacement for php scripts
> Allow multiple websites to be hosted on a single $5 VPS
> The utility is a simple binary, built with GraalVM, that allows you to work effectively with pcp.
Note that not all of PCP is AOT compiled. Just the command line utility. There's a daemon as well.
That said, seems like you should be able to do something pretty similar fairly easily with jars and the JVM (you may not want to run lots of JVMs in the method you're describing, since if you're calling these processes in a one-shot, CGI-style fashion, the JVMs startup time and memory requirements is going to be annoying.)
GP also linked babashka which may be closer to your interests, as its an interpreter for small scripts like these, but also comes with a mechanism (pods) for loading dependencies (like SQLite).
You’ll definitely want to restrict the JVM by memory, either by explicit flags (-Xmx ) or by running them in a cgroup or container.