Why Sponsor Oils? | blog | oilshell.org
Last week, DreamHost upgraded the shared server that this site runs on. The new configuration can no longer run FastCGI reliably, which means that our tiny but useful wwz app went down, and other apps are "at risk".
wwz is now back up as a regular CGI app, so users shouldn't notice much of a change.
Nonetheless, I started a long search for a new shared host, with shell access.
What's shared hosting? It's when you rent part of a big beefy computer, with a Unix kernel and a web server, that somebody else maintains. No virtualization, and no cloud.
To give you an idea, the new DreamHost box has 128 cores/threads and 512 GB of RAM. I have no idea how many accounts share it, but it's still fast. So static content will remain on DreamHost, but dynamic pages will live elsewhere.
I kept track of my search with many messages on our #server-side
Zulip stream. This led to the question:
The answer is tied pretty closely to purpose of the Oils project. So I collected comments I've written over several years, with the intention of writing:
That post grew too large, so this one contains just the comments about CGI and FastCGI, with some definitions and motivation.
Readers who "grew up" with the cloud might not know what these protocols are.
CGI is a Unix-y way for a program to generate a web page on the fly. It was the first way of creating dynamic web pages.
How does it work?
stdin
of a new process, which may be written in any language.stdout
.FastCGI is a less common protocol used for the same purpose:
So FastCGI is designed to address the deficiencies of CGI, though it's arguable how good a job it does.
This post resonated with me — I want lightweight scripting for the web. I want to write 10 lines of useful Python or shell, and deploy it instantly.
I also want to choose among many hosting providers that work the same way, e.g. using rsync
or git
to deploy.
The Demise of the Mildly Dynamic Website (devever.net
via lobste.rs)
65 points, 45 comments on 2022-05-02
PHP enabled dynamic web applications for the masses.
But I don't want to be limited to PHP. And I'm similarly unhappy with cloud solutions:
Recently we've seen the rise in popularity of AWS Lambda, a “functions as a service” provider. From my perspective this is literally a reinvention of CGI, except a) much more complicated for essentially the same functionality, b) with vendor lock-in, c) with a much more complex and bespoke deployment process which requires the use of special tools.
2024-06-26 update - This article was discussed on Hacker News a few days ago. I emphasized that CGI and FastCGI can scale exactly like AWS Lambda. PHP's stateless model scale to all Facebook servers worldwide, and CGI and FastCGI can do the same.
This post is from 2015, and observes that many users will be discouraged from writing CGI scripts in Perl.
The Long Death of CGI.pm (perlhacks.com
via lobste.rs)
14 points, 17 comments on 2018-04-20
CGI.pm has been removed from the core Perl distribution. From 5.22, it is no longer included in a standard Perl installation.
I just spent a week researching shared hosting, and none of them advertised Perl support. They occasionally mention CGI.
The same thing happened in the Python world: cgi.py
was deprecated with Python 3.11, and will be removed in Python 3.13. (PEP 594, 2019)
(Matěj Cepl points out this fork: https://github.com/jackrosenthal/python-cgi)
OK, we've established that that there are diminishing options for web scripting, which disappoints me.
Now let's talk about how CGI and FastCGI work.
The author of this post realized that CGI is a "polyglot" protocol, which can be used from any language.
CGI WTF (blog.syncpup.com
via lobste.rs)
39 points, 33 comments on 2023-01-06
My comment notes that starting a new Unix process per request, as CGI does, is not necessarily slow. When you write a CGI program in C, you're still starting a process, but it can complete in 1 to 5 milliseconds, not 100 to 500 milliseconds.
A program that proves the point is cgit, which is CGIs written in C, and you can see it’s plenty fast.
Another comment along the same lines on
Reminiscing CGI scripts (rednafi.com
via lobste.rs)
25 points, 35 comments on 2023-12-26
Instead, the main performance issues are:
Now let's talk about FastCGI. My recent experiences lead me to believe it's dead:
ssh
too! This is apparently because a cgroups
limit kicks in, preventing me from spawning any process, whether it's FastCGI or ssh
.That said, let's review some past threads about FastCGI.
My comment on
FastCGI is Pointless (2014) (ef.gy
via lobste.rs) - dead link
17 points, 10 comments on 2017-06-06
FastCGI has some bad parts, but the good part is process management. I just drop a file onto the server, and it "lazily" starts concurrent worker processes.
In other words, it gives me PHP-like deployment, but for Python.
My comment on
FastCGI – The Forgotten Treasure (2002) (nongnu.org
via Hacker News)
195 points, 93 comments - on Oct 5, 2020
I described my use of FastCGI on Dreamhost. The Python support was not good, but it worked. Now it no longer works.
Same story on lobste.rs:
FastCGI — The Forgotten Treasure (nongnu.org
via lobste.rs)
30 points, 46 comments on 2020-10-04
My comment noted that FastCGI is like "functions as a service", or "serverless".
This is a great blog post which I've quoted before, though it's now gone (404
). The hundreds of comments have more discussion of "serverless" cloud products, and the correspondence with FastCGI and CGI.
Back to the '70s with Serverless (evrl.com
via Hacker News) - dead link
518 points, 302 comments - on Dec 19, 2020
These two web servers seem to use interior shared library plugins, more so than exterior protocols:
The alternative is for a Python WSGI app to be wrapped in a normal HTTP server like gunicorn. A proxy server like nginx
can then handle load balancing and SSL.
It's two processes either way — it's just a matter of where you draw the boundary, and what protocol is at the boundary.
I think the author of "FastCGI is useless" above would also agree that the binary uwsgi protocol is also useless.
I'd like to use gunicorn and HTTP, but oddly OpalStack has native support for uwsgi, and no support for supervising long-running HTTP processes. A downside of shared hosting is that you're constrained by lack of root access.
That's all for now. Let me know in the comments if you've run FastCGI on a shared host recently!
(2024-06-26 update)
Nick Fagerlund is a fellow FastCGI enthusiast (and DreamHost customer):
Is there any way that I can write little apps using modern, nice-to-develop-in web frameworks (all of which generally expect to run their own server process), but host them on an affordable shared hosting account that won't allow me to run my own separate web server?
Can't I just live the PHP lifestyle, without having to write PHP?
What is Self Hosted? What is a Stack? (lucumr.pocoo.org
via lobste.rs)
11 points, 2 comments on 2024-06-26
I'm starting to think that the web needs new primitives. We now run some things commonly but the abstractions over them are not ideal. So people target (proprietary) systems directly. The modern web needs the CGI type protocols for queues, for authentication, for columns stores, for caches etc.
Why does it need that? I think it needs it to lower the cost of building small scale open source software.
Comments About Build Systems and CI Services (2021)
I'm still thinking about these ideas:
I want to unify the "build time" ideas with the "runtime" ideas:
I ran across this library:
I wondering if I could build it into Oils, so we could have lightweight FastCGI scripts in OSH and YSH.
But I'm not sure it belongs. Our philosophy is to reduce the amount of hand-written C and C++ code in the Oils binary. We want a stable core with few dependencies.
~/src/kcgi-0.9.4$ wc -l *.[ch] | sort -n
...
495 output.c
594 wrappers.c
599 kcgi.h
762 kcgihtml.c
770 fcgi.c
1121 kcgiregress.c
1135 kfcgi.c
1268 kcgi.c
1903 child.c
13743 total
Remember, Oils is pure C++ now — no more Python — which opens up many possibilities!