This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (50)
- # asami (19)
- # babashka (28)
- # beginners (68)
- # calva (34)
- # cider (11)
- # cljdoc (24)
- # clojure (148)
- # clojure-australia (1)
- # clojure-brasil (6)
- # clojure-europe (48)
- # clojure-france (13)
- # clojure-germany (4)
- # clojure-italy (6)
- # clojure-nl (19)
- # clojure-uk (22)
- # clojurescript (36)
- # conjure (3)
- # cursive (10)
- # data-science (1)
- # datascript (3)
- # datomic (12)
- # etaoin (3)
- # events (3)
- # fulcro (33)
- # graalvm (7)
- # honeysql (4)
- # jobs (4)
- # jobs-discuss (11)
- # kaocha (1)
- # keechma (4)
- # luminus (1)
- # malli (10)
- # membrane (8)
- # off-topic (34)
- # pathom (35)
- # pedestal (1)
- # re-frame (15)
- # releases (1)
- # remote-jobs (1)
- # reveal (41)
- # shadow-cljs (42)
- # startup-in-a-month (2)
- # vim (11)
Guaranteed Rate commercial during the Super Bowl had some Clojure on screen ... https://youtu.be/Nf0QvCq3quk?t=38
this frame has a reasonably legible view of the left pane w/ create- and update-loan! functions, middle pane is some functions for rates, can't read anything on the right
I'll often have multiple instances with at least that many tab open and I think it makes my girlfriend physically ill when she happens to look over my shoulder
on the other hand, the only thing on my desktop is my recycle bin and I'm suspicious of anyone who leaves documents and folders all over theirs.
Ooh I just learned about the
. keys on youtube to go back and forward a single frame. You can definitely get clearer screenshots that way!
“How did an underdog, always counted out, take down the biggest name?” I think Clojure was a reasonable choice of PL for this add.
Ever want to use Clojure like it was PHP on cheap servers? Now you can by combining Babashka with cgi-scripts on shared hosts! Learn more about the process at https://eccentric-j.com/blog/clojure-like-its-php.html. See an example at https://cgi.eccentric-j.com/metal.clj. View the source, then discover some helpful scripts, docker-files, and hints at https://github.com/eccentric-j/clj-cgi-example.
Did you perform any benchmarks of such solution? I'd be a bit afraid of the fact that you need to spawn new
bb instance for every single request (right?). And
bbbinary is 70MB..
I mean I like the fact that it's possible to execute
bb this way :thumbsup: , I'd just hope that people will not start trying to create full-blown webapps this way 😄
@U01LFP3LA6P I'm not sure if the binary size matter for memory usage. E.g.
bb -e '(+ 1 2 3)' give me:
You can even set
max memory: 17516 MB
-Xmxas the first command line arg to bb if you are worried about this. For max performance CGI isn't the best solution. You will go to a proper HTTP server (babashka also has one btw) and probably run JVM Clojure. I think you should consider this an experimental approach for personal side projects / low traffic websites.
Yes, the memory usage will be probably lower than the actual size of the binary. But still, even ~17MB per request is quite a huge overhead (when compared to handling a request in a long-running http server)
still, Eccentric J's solution might be a nice alternative for many personal side-projects, where you need to quickly hack together some http-accessible scripts backed by clojure code and you're not limited by performance. It's nice that you don't have to keep any additional server running -> don't have to monitor its status etc.
Nice @U8WFYMFRU! I’m curious if you know https://github.com/alekcz/pcp and how you would compare it. I’m guessing your approach fully exploits the features in babashka whereas PCP is based on Sci, but not as fully featured as Babashka. PCP might counter the memory issues @U01LFP3LA6P mentioned
From the blog post: > Github user alekcz (Alexander Oloo) has begun drafting PCP: A Clojure processor that runs a SCGI server that can act as a replacement for a long-running php-fpm process. This may not be best suited for a shared hosting service but would definitely be good for a VPS hosting service. I look forward to seeing it progress! Afaik PCP also needs a JVM to run.
Yeah good point. Different approach then. Nice to see these developments anyway
Yes found it the other day and linked to PCP in my article as an alternative. This solution with bb works with SimpleCGI. Where the script runs cold. PCP is more like FastCGI where there is a continuous process that a request client communicates with like how php-fpm works. You cannot run PCP on shared hosts, you will need at least a VPS.
Thanks for the explanation! And thanks for exploring this use of Babashka!
Next step is to convince the php hoster companies to make babashka available on their servers 🙂 (I forgot the name for these companies 🙈)
@U01LFP3LA6P I did not benchmark it but I doubt it would be reliable. Shared hosts are unpredictable, like a bathroom shared amongst many roommates 😂 While editing it I probably refreshed the page in the triple digits and it certainly wasn’t the fastest but it’s loading < 1 s for me which is sufficient given that I’m loading bb, Postgres pod, running a query, transforming css with gaka, and html with hiccup. I wouldn’t launch an enterprise, high-availability service with it but it seems very promising for putting together some MVPs.
The setup I am using for now is also the least optimized, might be a bit more performant to uberscript the entire project and run it through that as a single bundle and use carve to trim it down.
And then when you want to optimize it even further you can GraalVM compile it without using bb, or just produce static HTML for pages that don't need user input (if you want to continue going the CGI route)
> I did not benchmark it but I doubt it would be reliable. Shared hosts are unpredictable, Agreed. But one can still perform such benchmark on his local machine. Maybe someone will try it. It's not that important to do such benchmark. I was just curious, as I have no idea (nor a good estimate) of how poorly (or perhaps surprisingly well) this hacky-but-nice solution would scale. Maybe I'll try to benchmark this myself if I find some spare time.
$ multitime -n10 -s0 /usr/local/bin/bb tmp/meander.clj ===> multitime results 1: /usr/local/bin/bb tmp/meander.clj Mean Std.Dev. Min Median Max real 0.152 0.004 0.148 0.151 0.159 user 0.108 0.002 0.106 0.107 0.110 sys 0.041 0.002 0.037 0.040 0.045
I see so create a script that creates a request and waits for a response then run it with multitime?
@U8WFYMFRU I love this stuff. I've been really bothered by the infrastructure footprint of keeping live Clojure runtimes online, and this approach looks very promising.
@U066J7E2U I've seen several mentions of babashka on AWS Lambda. I think it works. There's also a blog post about it here: https://www.jocas.lt/blog/post/babashka-aws-lambda/ @U0FT43GKV I think it's the first time I see this blog post. Here is a specific setting for AWS Lambda: https://github.com/babashka/babashka#package-babashka-script-as-a-aws-lambda
The blog approach might need updating, maybe best to discuss in #babashka. People like @U0JEFEZH6 have mentioned that you can now do this more easily perhaps without "layers".
@UNAPH1QMN 💯 I underestimated how difficult it would be to make a meaningful database for this example that demonstrates the power without it becoming overcomplicated. Fortunately I was listening to my Igorrr playlist at the time.
@U06GS6P1N I’m glad to hear that! There are many small side projects I can just start busting out now instead of having to plan a whole stack, deploy system, and cloud platform research. It’s amazing how big of a difference removing those decisions make.
Added benchmarks to https://github.com/eccentric-j/clj-cgi-example#benchmarks
Announcing the 0.15.0 release of the #sicmutils computer algebra system for Clojure(script): https://github.com/sicmutils/sicmutils/ SICMUtils is a system built for interactive math and physics explorations in Clojure; it’s also got smoking fast numerical method implementations for when you do want to go fast. The latest release is fully compatible with #sci , and therefore easy to add to any environment (#nextjournal anyone?) that uses SCI for clj(s) evaluation. We’ve also upgraded the automatic differentiation implementation to handle higher order functions, and comparison and equality, so you can differentiate functions with internal conditional. Lots more in the release notes here: https://github.com/sicmutils/sicmutils/releases/tag/v0.15.0 Thanks to @mkvlr, @borkdude and @hcarvalhoaves for your help and contributions in the latest release. Please come say hi in #sicmutils if any of this sounds intriguing!