5 ms·
Anything, in any language can be written to not share state, to reload everything on every request and to throw out after the response. We're setting the bar p
by attrezzarturo 8y ago
Anything, in any language can be written to not share state, to reload everything on every request and to throw out after the response.
We're setting the bar pretty low for what's a good thing in a language here.
- Joeri 8y agoBut practically speaking you can’t though. You’re not starting a new java process on every request because the overhead is too big, and you can’t fully reset the jvm state for every request. PHP with fastcgi reliably and quickly resets the php process to freshly launched state after every request, and very few languages can manage that trick in a production context.
- ukblewis 8y ago<3
- attrezzarturo 8y agoPractically speaking it's done a lot. Even outside of web development. For example Gradle (a java build system) runs a daemon that hosts a bunch of tasks that run and die. Docker does it with images. The browser does it with tabs. Php achieves it with the help of server components. That is fine, but I wouldn't advertise it as a feature.
- jamespo 8y agoStarting a new docker instance for each http request is an interesting approach
- Walkman 8y agoThe article is about that it is FORCING you to do it. Erlang is designed to restart processes, because they also know it's very hard to keep state but don't leak memory or be in a good state for a long time. Every application server has an option to "restart after N number of requests" for the exact same reason.
- toast0 8y agoErlang is designed to restart processes when stuff goes wrong, because repairing is hard, and restarting is easy. This is different than PHP -- I hope my Erlang processes will have years of uptime, but I'm ok if they don't. My PHP requests have 30 seconds to live, and if they make it that long, they'll be systematically murdered (and, in some environments, the process they live in will be murdered after N requests, because even though PHP makes it hard to leak memory, developers rise to the challenge). This property is definitely one of the things I love about PHP -- when the request is done, everything is thrown away. This encourages you to do the minimum amount of work to get your HTML (or whatever) out the door. I'd like to say it forces you, but it doesn't really -- I've seen plenty of 'lightweight frameworks' that mess around for 50 ms creating cathedrals of objects that just get thrown away on a hello world page; if you do the minimum amount of work, you can get pages out the door pretty quick. Layering and abstraction can solve a lot of things, but it can't solve wrong abstractions.
- attrezzarturo 8y agoSure, but I'd expect a paid web developer to be aware of the statelessness of http to begin with, and also to rely on testing to get any form of guarantee of any kind. What I find ironic is that creating the illusion of state in php is an absolute pain without a framework, which again applies to most language/server combos I've tried.
- throwaway66666 8y agoWhich one has more chances into resulting the version variable not being overwritten. var const_version = 0.5; or const version = 0.5; Guidelines, good/bad practices and patterns are merely suggestions, enforcement is king.