4 ms·
How is restarting a go-based server harder than restarting a PHP-based server?
by heavenlyblue 9y ago
How is restarting a go-based server harder than restarting a PHP-based server?
- tluyben2 9y agoFor most setups at most ISPs, PHP servers are zero setup, self contained systems which, without any setup from the client (the user, you), comes back after reboot with no issues. It has also been the case for 15+ years so it's quite something you can actually trust to happen. This is not so for Go or Node for most hosters out-of-the-box. Sure in the HN echo chamber, every hoster offers this maybe, but there are literally 100000s of small/big hosting companies/resellers in the world that run, say, CPanel. And the only thing that is trivial there is LAMP (with PHP/MySQL) hosting; the rest is just not very convenient or even impossible. So once you set it up, no there is no difference, but then you have to know how to set it up, secure it, have access to set it up and secure it and know how to maintain it which is the point i'm making (not meant about specific environments besides PHP/MySQL); if you are a small company that needs to make money, you might not(!) want to bother. Edit: Cpanel, in some near-future version will offer Node, I cannot find Go though. Edit2: I'm definitely not recommending anything here or saying Cpanel is any good; I just know it well and I know that it's the most installed 'admin panel' on hosting servers.
- stephengillie 9y agoSo this is about the technical decisions made by small businesses, and how those decisions impact engineers?
- Can_Not 9y agoYou'll need the go process to complete all ongoing requests before restarting it. Whether that be RPC, HTTP, WS, etc. And this is behind a load balancer, so did you just go offline, or are you doing this one at a time? With PHP, you don't have to restart php-fpm or modapache. Just git-pull or FTP the new files in and the next HTTP request will automatically user the new version. Zero downtime. Honestly though, I expect something like AWS and GCE to already have our to be building a solution to handle the go scenario efficiently for you.
- _ph_ 9y agoThis would be easily achievable by having 2 processes: one, which accepts the socket connections and relays them to the subprocess which does the actual work. New subprocesses could be started any time for updates, without killing existing connections. All new connections would be handled by the new subprocess.
- Can_Not 9y agoSo, basically what you get for free in erlang and PHP, but not in golang?
- _ph_ 9y agoRight, as Go is compiled into a static executable, you can't do code updates on the fly that easy. A small price to pay in a production environment. On the other side, you do have all compiler checks run while building.
- heavenlyblue 9y agoHow do you deal with changes to multiple files at the same time? What if a subset of users see updated file A but not file B? You don't have such things in other languages simply because they have not been initially created as glorified templating engines. More importantly: for example, Django in debugging mode allows you to swap templates on the fly, so is with the executable code. Except nobody does it because that's considered ridiculous.