4 ms·
> And compared to Java, the fact that Go compiles to a native binary is a huge benefit. I'm baffled by this. I've been deploying Java applications for years, a
by twic 11y ago
> And compared to Java, the fact that Go compiles to a native binary is a huge benefit.
I'm baffled by this. I've been deploying Java applications for years, and this has literally never been a problem. You build a WAR (or EAR, or uberjar, or distzip, or whatever). You install a JRE on the machine. You deploy. You're done. It's never been a problem for me, and it's not something that's talked about as a problem in the Java community, which suggests it's not a problem for other people.
When i see someone suggesting that Go has a significant advantage over Java in terms of deployment, i assume that they don't actually have experience of deploying Java apps, they're just regurgitating the standard Go talking points.
- andrepd 11y agoI think you must agree that no matter how painless it is, binary < JAR + JRE, in terms of deployment effort.
- Skinney 11y agoDepends. For me, creating an uberjar with my default project/package manager is easier than to setup cross-compilation with Go. YMMW.
- nulltype 11y agoWhy don't they just combine the JRE and JAR file? Then I can be sure it works when I download it.
- Skinney 11y agoFor the same reason you don't deploy Windows, BSD and Mac OS X binaries of your Go program to a Linux server.
- nulltype 11y agoYeah I use the Linux binary, I'm not sure what you're saying here.
- Skinney 11y agoThe JRE is platform specific, the JAR isn't. Bundling them makes little sense.
- nulltype 11y agoI think it makes a lot of sense. I can download the Windows version of an app and double click on it and it runs. As opposed to I double click on it and it's all "oh you don't have a JRE" or "you have the wrong JRE, mysterious error" or "you need to install this JRE", or it installs a JRE for me, but another app requires a different JRE.
- falcolas 11y ago> You deploy. You're done. Then you set your memory parameters. Then you tweak them, to make it more performant. Then you increase them some more to make the GC work less. Then you hook up to the JMX port so you can profile what's going wrong, and identify some XML library as allocating megabytes of strings when it then dumps. Then... Yeah.
- valertin75 11y agoLooks like you don't like working on projects beyond something that says "Hello World"
- Alphasite_ 11y agoYeah. But you don't have to, you're literally complaint that the user has options. It's not like Go doesn't have a GC either.
- nosequel 11y agoExactly, and Go's GC is years behind the JVM.
- waps 11y ago2 things play in favor of Go on memory usage though: 1) Go is in honeymoon phase. There aren't any 10 million plus lines of code Go codebases. So "Go is not complex". That said in java-land there is often not a very good reason for complexity. I just examined a GWT job scheduling tool and for displaying fields in the UI they had 5 interworking classes - just to avoid manually coding the dialog. In java-land people constantly do that - why ? They had recordbuilders and ui-from-record-builder and ... That said, these days you see people using Go's introspection to create dialogs in javascript - that was a lot more complex still. So while the length of backtraces in Go's crashes has been steadily going up, it seems to be at around 6-8 levels deep these days. I have to say though, I much prefer panics and exceptions over Go's error handling (or as you will come to see it after seeing what "average" programmers do with the errors - Go's error ignoring) This honeymoon also means the amount of idiot-written code in Go is much smaller than in Java. Also, a lot of code in java was written to the previous sets of programmer fancies. Half the libraries you use in a particular project are XML configured, because that was the best practice in 2000-2005 (even still visible in things like android apps), another set is using dependency-injection patterns, another set requires POJOs and uses introspection, and the last set has it's own custom configuration language (I hate gradle, and yes this is because just doing things with cli tools is apparently not done in java-land, I don't care). 2) Go has a better memory model than Java. Because you can nil out every java object, every java object has to be a pointer. So initializing an object that contains 5 other objects requires 6 heap allocations and constructor invocations - minimum. After construction the GC has a new tree of 6 objects to walk on every invocation. This is not the case in Go (uninitialized non-pointer objects aren't nil, you only use pointers where you actually need them), and results in much more compact memory. I see it as a flaw in java these days.
- sleepydog 11y agoAs someone else who has been deploying Java applications for years, I'm not saying it's hard, but you have to take care when upgrading the JRE on a server, because with most setups (such as the default Sun JDK RHEL packages) it's a shared resource. You can go ahead and bundle a JRE with your jars. With Go this specific problem doesn't exist.
- twic 11y agoFair point. I've always used the approach of dedicating a machine to one particular application (using virtual machines once those became available), so the impact of upgrading the a global JRE is limited. I did once work on a system where we installed two JREs in parallel, and selected which one to use for the app based on an entry in the manifest file. That let us upgrade Java versions under application control, without requiring sysadmin intervention. Took a couple of lines of shell script.
- politician 11y ago> You install a JRE on the machine. You deploy. That's two steps. The first one can ruin your day.
- threeseed 11y agoHow so ? It takes minutes to install it. Just download it, copy it and set JAVA_HOME to make it easier for other applications. I've done this on hundreds of servers during my lifetime and never once had an issue.
- sdenton4 11y agoOh, look, there's already an antique jre installed on my os, not compatible with the particular jre needed by this application, which I first need to uninstall. And then hope that it doesn't break anything else in the process, because I haven't been following the minutae of java development environments for the last n+1 years... I think it falls solidly in the "easy if you know it, and a wasted q hours if you don't" category.
- amaranth 11y agoThat's why he said to set a JAVA_HOME so this JRE can exist separately from the system one.
- sagichmal 11y ago> You install a JRE on the machine. Whoops. That's where you lost me.
- serge2k 11y agohmm, well we can dumb things down if you really need it. I think things are already pretty simple though.
- twic 11y agoFair enough. I certainly agree that Go is an excellent language for people incapable of doing basic stuff like this.
- sagichmal 11y agoI'm perfectly capable, I just don't see the reason. Why should I install a JRE to run your program? The JRE has nothing to do with your program; it's incidental complexity. Go gives us a way to eliminate that incidental complexity and so is a step forward.
- djhworld 11y agoI suspect this comes from classic Java setup of using an application container like weblogic, websphere, JBOSS or web containers like Tomcat.
- fauigerzigerk 11y agoYou never had any classloader issues with things like logging libraries and their configs or XML parsers? No versioning problems with dependencies of dependencies getting confused at runtime? No inconsistent clasloader behaviour with differnt Java EE containers? I'm not saying that library versioning and dependencies are not a problem with Go. Quite the contrary. But it's a compile time issue. There are far fewer surprises at runtime and that makes deployment a lot easier.
- taylodl 11y agoI'm surprised you didn't mention Java compiles to byte code which is then JITed for the processor on which you're currently executing - I don't need to recompile for every platform and I still get native performance. This has been Java's primary strength since the introduction of JIT. Even better, I don't have to use Java to create the byte code. My favorite happens to be Clojure but you have several language options to suit your needs.