TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

FastCGI – The Forgotten Treasure (2002)

195 pointsby camnoraover 4 years ago

25 comments

chubotover 4 years ago
I&#x27;m still using FastCGI! It works well on Dreamhost.<p>The Python support is not good! In theory you just write a WSGI app, and it will work under a FastCGI wrapper.<p>But I had to revive the old &quot;flup&quot; wrapper, since Dreamhost has Python 2. I downloaded an older tarball and build it myself.<p>Use case: I parse thousands of shell scripts on every release and upload the results as a &quot;.wwz&quot; file, which is just a zip file served by a FastCGI script.<p><a href="https:&#x2F;&#x2F;www.oilshell.org&#x2F;release&#x2F;0.8.1&#x2F;test&#x2F;wild.wwz&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.oilshell.org&#x2F;release&#x2F;0.8.1&#x2F;test&#x2F;wild.wwz&#x2F;</a><p>So whenever there&#x27;s a URL with .wwz in it, you&#x27;re hitting a FastCGI script!<p>This technique makes backing up a website a lot easier, as you can sync a single 50 MB zip file, rather than 10,000 tiny files, which takes forever to stat() the file system metadata.<p>It&#x27;s more rsync-friendly, in other words.<p>I also use it for logs in my continuous build: <a href="http:&#x2F;&#x2F;travis-ci.oilshell.org&#x2F;jobs&#x2F;" rel="nofollow">http:&#x2F;&#x2F;travis-ci.oilshell.org&#x2F;jobs&#x2F;</a><p>-----<p>Does anyone know of any other web hosts that support FastCGI well? I like having my site portable and host independent. I think FastCGI is a good open standard for dynamic content, and it works well on shared hosting (which has a lot of the benefits of the cloud, and not many of the downsides).
评论 #24686595 未加载
评论 #24686615 未加载
评论 #24684579 未加载
评论 #24684805 未加载
eiy5weiNover 4 years ago
I went a step further and spent most of my free time this year writing CGI&#x2F;C apps.<p>This was not nostalgia either : the reason for doing that is because I was writing webapps for my pinephone. Toying with the phone, I decided I wanted my apps to be webapps rather than GTK apps, so that I can access them either from mobile or laptop (through local network), but I didn&#x27;t want to have the apps running all the time, in order for them to consume less energy (which directly translates to battery lifetime on a mobile). Turns out that CGI is perfect for that : the only process always running are nginx and fcgiwrap, then all my apps are started only on demand, for the lifetime of the request.<p>I did expect a big performance hit, but I was surprised it was not so bad. I guess that&#x27;s because they are C app rather than written in languages which require loading an interpreter before running anything. One app that I rewrote from libmicrohttpd had actually better perfs (although it was the first time I used libmicrohttpd, so it was probably something I didn&#x27;t do correctly).
评论 #24687701 未加载
评论 #24687541 未加载
评论 #24691333 未加载
评论 #24687093 未加载
评论 #24687583 未加载
hardwaresoftonover 4 years ago
Don&#x27;t worry, I don&#x27;t think these lessons were forgotten -- we&#x27;ve made your way back full circle already with &quot;serverless functions&quot; if you squint a little bit.
评论 #24686687 未加载
评论 #24685959 未加载
评论 #24684116 未加载
francislavoieover 4 years ago
I disagree a lot with this article&#x27;s opinions on PHP. It sounds like coming at it from the perspective of someone who hasn&#x27;t used it in over a decade. Modern PHP with frameworks is just about as good as it gets for web development.<p>Edit: oh lol, this was written in 2002, alright, that confirms that.
评论 #24685383 未加载
no_wizardover 4 years ago
I can’t find any good information on implementing a fastcgi compliant server. Does anyone happen to have information about how to do this? I think it would work well for some applications I have and I can’t find anything to increase my know how to take in incoming fastcgi requests. Think nodejs in particular but language agnostic documents would be best
评论 #24684040 未加载
评论 #24684301 未加载
评论 #24685093 未加载
评论 #24684121 未加载
评论 #24686157 未加载
评论 #24684592 未加载
woadwarrior01over 4 years ago
~15 years ago, I was tasked with implementing FastCGI support for a webserver I was writing in C++, so that it could proxy some downstream crud stuff written in Python. After mulling over it for a couple of days, I ended up implementing SCGI[1] support instead. SCGI is like FastCGI, but a lot simpler to parse, IIRC.<p>[1]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Simple_Common_Gateway_Interface" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Simple_Common_Gateway_Interfac...</a>
评论 #24686352 未加载
评论 #24687457 未加载
ammmirover 4 years ago
FastCGI was one of my favorite silver bullets for improving the speed of &#x2F;cgi-bin&#x2F; programs. I used to have slow machines where the Perl interpreter startup time would be significant, so rewriting the script around an fcgi loop made a huge difference. The script could stick around serving requests, and if you feared a memory leak, you could just exit() after a hundred requests or whatever, and the FastCGI spawner would restart them on the next request.<p>It wasn&#x27;t as fast as something like mod_perl [1], but much easier to integrate with quickly hacked scripts, as long as you were lexically scoping everything with my() and not screwing up your globals. Fun times.<p>[1] <a href="https:&#x2F;&#x2F;www.perlmonks.org&#x2F;?node_id=108008" rel="nofollow">https:&#x2F;&#x2F;www.perlmonks.org&#x2F;?node_id=108008</a>
peteeover 4 years ago
Its too bad this never got more traction, I always thought the ability to define roles was an incredibly smart and useful feature. Defining &#x27;authorizer&#x27; and &#x27;filter&#x27; allows you to stack all sorts of independent apps - responder provides data, filter does rendering, authorizer is SSO, for example.<p>Wprth mentioning that Openbsd does have fastcgi support in it&#x27;s httpd server, but only supports the responder role
评论 #24685927 未加载
zoobabover 4 years ago
Kapow is great to transform shell scripts in web apps:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;BBVA&#x2F;kapow" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;BBVA&#x2F;kapow</a>
评论 #24686022 未加载
评论 #24685808 未加载
评论 #24685829 未加载
cluomaover 4 years ago
After hearing about CGI I became a bit obsessed with its simplicity and started writing my blog[1] as a CGI app, eventually incorporating a FastCGI library later.<p>Performance-wise I don&#x27;t know how it would compare to other options, but I think it&#x27;s a great way to expose C&#x2F;C++ code to the web.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;cluoma&#x2F;bittyblog" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cluoma&#x2F;bittyblog</a>
thayneover 4 years ago
Is there an advantage to using fastcgi to using plain http with an async application server?<p>Or how about using http&#x2F;2 for multiplexing?
评论 #24684536 未加载
评论 #24684763 未加载
guitarbillover 4 years ago
Java servlets were likely inspired by FastCGI, and WSGI (Web Server Gateway Interface, Python) is known to be inspired by both, so I doubt that&#x27;s true. There were just more convenient solutions than having to write the IPC part yourself.
评论 #24684819 未加载
umviover 4 years ago
I love fastcgi - a quick and easy way to have lightning fast C&#x2F;C++ backends. Unfortunately there aren&#x27;t many maintained fastcgi libraries out there.
bobowzkiover 4 years ago
It&#x27;s interesting to revisit technologies I couldn&#x27;t comprehend when I got started in programming, way back in 1995 or so. Now I finally understand exactly what&#x27;s going on.
FpUserover 4 years ago
So we&#x27;ve just rediscovered stateful web applications. Been doing those since early 90&#x27;s and still doing it now (well among lots of other things). The difference for me is that I&#x27;ve never went for FastCGI. I would instead embed HTTP server in the application itself. In the beginning when the whole concept was young said server would face the outside world directly, now it is hiding behind reverse proxies like Nginx.
评论 #24684560 未加载
rasculover 4 years ago
2002
评论 #24683695 未加载
earthboundkidover 4 years ago
Does FastCGI have a history of security bugs due to environment var &#x2F; header confusion or just regular CGI?
评论 #24684305 未加载
评论 #24684393 未加载
评论 #24685111 未加载
评论 #24686133 未加载
davidglover 4 years ago
There is still <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Apache_JServ_Protocol" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Apache_JServ_Protocol</a> which Apache, nginx and IIS support
distantsoundsover 4 years ago
&quot;PHP was never meant to be used to write complex web-based applications.&quot;<p>oh, whoops.
评论 #24687901 未加载
评论 #24687552 未加载
throwaway189262over 4 years ago
Wow, quite a blast from the past!<p>Does anyone know how FastCGI compares to performance with fast VM languages that self host like Go, C#, Java? I remember it being fast compared to CGI with Perl... But thats a pretty low bar
评论 #24687727 未加载
procdover 4 years ago
php-fpm any one? not that forgotten
david422over 4 years ago
I tried to write some cgi&#x2F;fastcgi apps in C++ with apache. A lot of documentation has disappeared from the web sadly.
zellyover 4 years ago
the original Heroku&#x2F;AppEngine
perlpimpover 4 years ago
that&#x27;s how we launched our first site, deal maker just before publishing to slashdot.
johndoe42377over 4 years ago
The advantage of FastCGI protocol is that it is a multiplexed connection.<p>HTTP&#x2F;2 and newer are basically the same.