5 ms·
>>Why are there no other "competitors" in this space? There are. Any language that supports either fastcgi, or runs as an apache plugin (or similar) functions
by tyingq 10y ago
>>Why are there no other "competitors" in this space?
There are. Any language that supports either fastcgi, or runs as an apache plugin (or similar) functions in the "each request starts new" space. There's certainly others, but Python and Perl are both good examples.
Starting new with each request does, of course, mean lots of re-work that shouldn't have to be done with each request. It does initially keep complexity down, but at scale, the applications I've worked with have to use a shared cache (like acpu) to avoid that rework and meet performance goals.
- Klathmon 10y agoI mean more of languages that actually "target" this kind of setup. I know it can result in a lot of "extra work", but I really feel like most of the pain of that could be abstracted away by the runtime. Nginx/apache setup a PHP process before the request comes in, so why couldn't you expose that point to your language and let the programming language do work before that point, even "snapshot"ing it to avoid re-doing that work for each request? It just seems like there are better ways of solving this problem, because an event loop is such a "hammer" solution to the problem.
- jstimpfle 10y agoI think python has exactly that with WSGI. With this protocol you make a module containg an "application" function object which is called by the server when a request arrives. On module load time you can do any required setup work. (On my systems, by default there is some reuse of the loaded module, so you can leak state between requests. However it should be possible to avoid reused processes).
- ryanlm 10y agoCan you set up Python to have the same pattern as PHP? I've always had to proxy the web server to the Python process running HTTP.
- tyingq 10y agoPython via fastcgi, wscgi, etc, is the same pattern. Or mod_python inside Apache.
- deleted 10y ago[deleted]
- gkya 10y agoimport cgi Also, the httpd communicates to the CGI program via environment variables so one can also write their program in assembly.
- dfsegoat 10y agoYeah, I run new django apps right alongside my php5 code. It does definitely take a bit more "muss and fuss" than php5 to configure (mod_wsgi, etc) but is just as easy. You also need to restart apache or change the wsgi loader file, (or set up explicit hoooks to do so) to get your new code to appear when debugging / after uploading changes. This is where I'd say php is superior (upload file, refresh browser).
- ubernostrum 10y agoBack in the day, mod_python also supported PSP (Python Server Pages), which was similar to PHP/ASP in that it allowed you to write a file as a mix of HTML and Python code inside delimiting tags.