Live data from Hacker News

Go as an alternative to Node.js for Very Fast Servers

techblog.safaribooksonline.com

131–140 of 147 posts

Re: Go as an alternative to Node.js for Very Fast Servers

#131
post #115

Earlier quoted context omitted.

Can I ask what language you are used to? I hear how nice go is as a language a lot, but coming from haskell, go is hideous in comparison.

I studied Haskell for a decade with the goal of actually using it for production software. When I finally found a nice gap to try it, the experience was mostly awful. Go was such a huge relief after that horrible catastrophe language that seems to still continue to wreck new generations. Please, please, don't poison your career on focusing on a single language, especially one as disturbing as Haskell.

What were the specific problems you had with haskell?

Re: Go as an alternative to Node.js for Very Fast Servers

#132
post #67

Earlier quoted context omitted.

I've done Java, PHP, Objective Caml (in college for a few years), some basic C, Ruby and Javascript before and I concur. Go is a real breath of fresh air. I have the same feeling I have when I code with Ruby: that sense that the language works WITH me, that the whole experience is smooth and seamless. I wish Go stays on that path for a long time. And it never gets TOO big, which makes for awful communities.

Maybe you didn't do much OCaml? I've found it to be mostly significantly better than Go, especially with it's type system. Go's type system is relatively limited and ad-hoc where OCaml's is extremely elegant, simple and consistent. In particular, OCaml has an awesome module system and a great take on structural sub-typing combined with proper type inference and sane parametric polymorphism. Having actual algebraic da…

Yeah, like I said, it was mostly during 2 years in college (in France in the close-knit network of research institutes and universities where the language was actually born) and OCaml is a wonderful language. It has numerous upsides (type inference, the mixed functional/OO paradigms, non-verbose, relatively fast, the awesomeness of pattern matching).

I was mentioning it in my previous comment to provide perspective on my opinion of Go.

I am a big supporter of the idea that all languages have their advantages anyway :)

Re: Go as an alternative to Node.js for Very Fast Servers

#133
post #102

Earlier quoted context omitted.

Let me clarify then: I think that a consensus was built in the mid-90s that Java was a pain in the ass and not an improvement over what was available in that particular field at the time (not as easy as other higher-level languages and not as good or fast as C or C++). I have a feeling that people over time consolidated that consensus through some form of confirmation bias even though the Java/JVM ecosystem had made…

It's not the JVM or the ecosystem, but the language itself. It is clunky and generally irritating to write and read. But the libraries and its niche sophistication (basically enterprise middleware and webapps) are second to none, so people put up with it. Note: I've been writing it professionally since 1999, currently working a lot with ServiceMix so I'm knee-deep in the enterprise stuff.

Exactly, the JVM and the ecosystem are just fine. There is no particular hate for them, just look at Clojure.

Re: Go as an alternative to Node.js for Very Fast Servers

#134
post #123

I wonder how Go compares to SilkJS, since SilkJS is much faster than Node.

SilkJS uses mostly the same libraries and relay on the same VM as Node.js: V8. So it can't be much faster. The note how it outperform Node.js http server, you can read from start page of its github repository, are misleading since it uses multiple processes (SilkJS http server forks itself).

Re: Go as an alternative to Node.js for Very Fast Servers

#135
post #47

Earlier quoted context omitted.

Benchmarking on macbooks is often an exercise in testing the mediocre default configuration of the network stack, not your language. My macbook pro gets 4k rps with apache, node, go, and nginx. YMMV and all that, but I'm always wary.

What configs do you change?

I usually just benchmark in a production environment.

Re: Go as an alternative to Node.js for Very Fast Servers

#136

Earlier quoted context omitted.

Go's package manager does have version control. It looks for specially named branches (different ones depending on the version of go you have). The upstream authors can provide a different version of the software for different releases of Go. If you want to lock down the versions of all the software you're deploying in your organization, that's easy to do too. Just "git clone" all of the libraries you use to some int…

The go import tool does version go std lib packages, but I think the worry is more about external packages - later when the go ecosystem matures, and I'm relying on lots of packages from different sources (say for a web app), with interdependencies, and I must update them regularly for security updates, but don't necessarily want the latest master for all, I have no way to specify versions without rolling my own pers…

it'll be interesting to see how go manages this when go packages become more complex and widely used, start to be removed by maintainers, and start to have complex chains of dependencies on specific versions

"Complex chains of dependencies on specific versions" is an anti-pattern, common in the Java world. I am glad that Golang doesn't support or encourage this anti-pattern.

If someone deletes your favorite package, then you can just re-upload it from your cache and let people know about the new URL-- assuming that the code is open source.

If you want to make a backwards-incompatible change in your library, then just create a new version and call it something (slightly) different. There's no reason to complicate things.

Re: Go as an alternative to Node.js for Very Fast Servers

#137

Earlier quoted context omitted.

The go import tool does version go std lib packages, but I think the worry is more about external packages - later when the go ecosystem matures, and I'm relying on lots of packages from different sources (say for a web app), with interdependencies, and I must update them regularly for security updates, but don't necessarily want the latest master for all, I have no way to specify versions without rolling my own pers…

Great having one bringing a balanced view on Go and showing that Go is still not ready for production when used with external libs. A refreshing take in this overhyped thread.

Java and C++ never developed package management at all, but have been used in production for years. Golang is already ahead of those languages here.

Re: Go as an alternative to Node.js for Very Fast Servers

#139
post #118

Earlier quoted context omitted.

Compilation units can rely on each other through forward declarations, so the dependency graph is not acyclic. Header exclusion does form a DAG within a compilation unit, I guess.

A forward declaration is not really a compile time dependency. If you are forward declaring a function, you are just promising that it is present during linking. So, during compilation it is not an edge in the graph. If you are forward declaring a data type such as a class, a full definition needs to be visible at its first use or you are using the type as a pointer: class A; class B { A *d_a; [...] }; In this case i…

Yes, but it is still a dependency. By which I mean the software won't run if you don't supply the necessary thing at resolution time (which is possibly quite late: well into runtime, if you are on a system with lazy linking). Go (and some other languages, like OCaml) enforces that such dependencies form a DAG: C++ does not.

I don't think this has much to do with compilation speed though.

Re: Go as an alternative to Node.js for Very Fast Servers

#140

Earlier quoted context omitted.

The go import tool does version go std lib packages, but I think the worry is more about external packages - later when the go ecosystem matures, and I'm relying on lots of packages from different sources (say for a web app), with interdependencies, and I must update them regularly for security updates, but don't necessarily want the latest master for all, I have no way to specify versions without rolling my own pers…

it'll be interesting to see how go manages this when go packages become more complex and widely used, start to be removed by maintainers, and start to have complex chains of dependencies on specific versions "Complex chains of dependencies on specific versions" is an anti-pattern, common in the Java world. I am glad that Golang doesn't support or encourage this anti-pattern. If someone deletes your favorite package,…

"Complex chains of dependencies on specific versions" is an anti-pattern, common in the Java world.

I do have some sympathy for this radical simplicity which Go aims for, but at times it comes at a cost, and at times a little bit of complexity has to be added to deal with the real world (only very rarely and after much thought though). I'm torn between admiring that they don't rush into new features and impatience with a few small things they've refused to add so far.

If someone deletes your favorite package, then you can just re-upload it from your cache and let people know about the new URL-- assuming that the code is open source.

Well yes, but then you're de-facto maintainer of that package, you might not have permission to do that, etc - this point though I feel is less important than versioning, it's more an argument for central package control, which has pros and cons. I'd be happy if Go never does that and agree that it can be worked around but will be interested to see if people judge it necessary eventually. There's nothing to stop people setting up a central package resource, and nothing really needs to be added to go to support it.

If you want to make a backwards-incompatible change in your library, then just create a new version and call it something (slightly) different. There's no reason to complicate things.

This is not an acceptable solution, it would lead to situations like:

    import 'github.com/user/yaml_parser'
    import 'github.com/user/new_yaml_parser'
    import 'github.com/user/really_new_yaml_parser'
    import 'github.com/user/toms_new_yaml_parser'
What a mess, particular for new users trying to decide which package is best or canonical. Why not just use versions?

I wouldn't be so quick to defend the status quo - Go is a young language with plenty of maturation still to do, they could easily add versions to packages if it proves necessary - I suspect in the long term it will, because large ecosystems do involve chains of dependencies (I'm not talking about java here, but perl, python, ruby, java, C++, etc all of these languages version libraries in some way), and developers of packages make mistakes which they need to fix, sometimes by deprecating or removing compatibility, but their users don't want to deal with those mistakes, sometimes for years, and the users of their users certainly don't. Choosing a new name and orphaning all your users is not an acceptable solution.

I'd prefer if package maintainers could just do this:

    import 'github.com/user/yaml_parser'
    import 'github.com/user/yaml_parser/1.0'
    import 'github.com/user/yaml_parser/1.0.1'
etc and left the master as the plain name with version tags as longer names. It'd be nice if go supported this by supporting arbitrary branches or tags on github etc but I don't think it does at present, happy to find out I'm wrong.
Post reply on HN