4 ms·
> a persistent process makes everything much simpler ... I started with PHP and never trusted persistent processes for anything. What if your persistent proce
by scotty79 4y ago
> a persistent process makes everything much simpler ...
I started with PHP and never trusted persistent processes for anything.
What if your persistent process hangs or crashes for whatever reason?
Is your whole site down then, not just the part with the bug?
The only site I ever made in persistent process paradigm was in ASP.NET and it didn't cause too many problems but it was more of an app, not website, with limited number of logged in users and pretty much no anonymous/guest part.
- wizzwizz4 4y ago> What if your persistent process hangs or crashes for whatever reason? You've got the same problem with your web server, and your operating system kernel. Simply write a program that can't hang or crash – at least, not due to an application bug. It takes attention to detail, but this is a lot easier than writing a program that always behaves correctly; if you limit the syscalls you make, use timeouts appropriately, and don't segfault, it's often achievable.
- scotty79 4y agoI don't think any mainstream framework in any mainstream language has these kinds of precautions. Rails? Django? Express? .NET? Do they kill long running requests so they don't affect whole application? Can the application still mostly work despite syntax error in one of the files? Another thing is level of trust. I trust Linux kernel, I trust apache webserver. But some webserver written in scripting language few years ago? Not so much.
- Semaphor 4y ago> .NET? Do they kill long running requests so they don't affect whole application? Not sure about the built-in .net server, but IIS does exactly that. It supports timeout and error/time based restarts for the persistent process.
- alerighi 4y agoWell try in a nodejs server to put a `while(true);` in a request handler. Do you know the answer? The whole process blocks, since nodejs is single process. I trust more the code that I wrote than the code written from others... not because I'm better than others, but because I know what it does, and I know how to fix it if it breaks.
- scotty79 4y agoIt still wouldn't hurt if the framework just killed it after 3 seconds with timeout message.
- rusebor 4y agoErlang
- ilyt 4y ago> I started with PHP and never trusted persistent processes for anything. Well it's (maybe was, it did get a bit nicer over years but old shit code is still there) terrible language so no wonder you have no trust. > What if your persistent process hangs or crashes for whatever reason? depend on language. For example in Go (in most frameworks at least) panic() in goroutine handling request will just... nuke that request and nothing else. Sure, memory leaks can be issue if the code is terrible but essentially restarting app after every request is just shitty workaround for shoddy code. That's how most other handle code. Other, that do multi-core processing badly like Ruby, just spawn multiples of server so it isn't really that different from PHP model, you get "supervisor" that spawns few processes of app and feed them requests, if one dies it just gets restarted.
- wwweston 4y ago> Well it's/twas terrible language so no wonder you have no trust The reason someone who was shaped by working in PHP might not trust long-running processes probably has less to do with any specific shortcomings of it as a language and more to do with the fact that overwhelming execution model is single-request shared-nothing. This conceptual model works well enough (especially for the web) there's entire cloud services built around recreating it for other languages called "serverless," and they do well because it's a useful simplification which means the issues associated with persistent processes become somebody else's problem. Devs being what we are, of course there's always those of us who prefer certain things to remain our problem. This is fortunate as someone needs to assume problems like long-running processes in order for others to make it somebody else's problem. Software development has some things in common with comparative advantage.
- kefka_p 4y agoFault tolerance was how Next branded it, IIRC. If an instance of a long running process doesn’t communicate with an external monitor, then it’s assumed to have hung or crashed at which point it is restarted by the external tool. Or at least that’s how things were done in the early/mid 90s. Like techniques are employed by Node apps these days, and undoubtedly many others.