Re: [go-nuts] What Linux distribution is recommended for Golang web server?

3,021 views
Skip to first unread message

Jan Mercl

unread,
Jan 3, 2013, 11:34:34 AM1/3/13
to ths...@gmail.com, golang-nuts


On Jan 3, 2013 5:19 PM, <ths...@gmail.com> wrote:
>
> There are other consideration to not use Windows Server too.
>
> This leads to decision to use Linux. What Linux distribution
> is recommended for Golang web server?

At work I maintain a multifunction server running Ubuntu Server 64b  12.04 LTS on an 8 core  machine and I'm quite happy with it so far. (Intranet only, frozen w/ no OS updates nor Internet connectivity).

-j

Harley Laue

unread,
Jan 3, 2013, 11:39:15 AM1/3/13
to golan...@googlegroups.com
On 01/03/2013 10:19 AM, ths...@gmail.com wrote:
> I am using Go as a web server. Tested for a month
> under Windows Server 2008 Virtual Machine but it runs for a day
> and then stops with a message: "The specified network name
> is no longer available".
>
> There are other consideration to not use Windows Server too.
>
> This leads to decision to use Linux. What Linux distribution
> is recommended for Golang web server?
>
I can't really speak for others, but my two defaults for a Linux server
are CentOS and Ubuntu Server. It really depends on what you're
comfortable with maintaining.

As a sort of general notes (and should be obvious), have a development
server with the full Go stack to build and test the application and an
identical server with the bare minimum packages & locked down to run the
resultant binary. Another common techniques are having a server running
something like nginx to proxy requests to your server(s)/app(s).

Matt Kane's Brain

unread,
Jan 3, 2013, 11:46:26 AM1/3/13
to Harley Laue, golan...@googlegroups.com
On Thu, Jan 3, 2013 at 11:39 AM, Harley Laue <losingge...@gmail.com> wrote:
I can't really speak for others, but my two defaults for a Linux server are CentOS and Ubuntu Server. It really depends on what you're comfortable with maintaining.

CentOS 5.x is unsupported (although this is not the latest)

--
matt kane's brain
http://hydrogenproject.com

Harley Laue

unread,
Jan 3, 2013, 12:11:44 PM1/3/13
to Matt Kane's Brain, golan...@googlegroups.com
On 01/03/2013 10:46 AM, Matt Kane's Brain wrote:
On Thu, Jan 3, 2013 at 11:39 AM, Harley Laue <losingge...@gmail.com> wrote:
I can't really speak for others, but my two defaults for a Linux server are CentOS and Ubuntu Server. It really depends on what you're comfortable with maintaining.

CentOS 5.x is unsupported (although this is not the latest)

While that may be true, I have had some success using Go with CentOS 5 (though os/exec tests fail...) That said, I'd highly recommend the CentOS 6 series if CentOS is a consideration.

Andy Balholm

unread,
Jan 3, 2013, 12:25:22 PM1/3/13
to golan...@googlegroups.com, Matt Kane's Brain
Whichever distribution you choose, use the 64-bit edition of it if you can. Go programs usually run faster on 64-bit, and garbage collection is more reliable.

André Moraes

unread,
Jan 3, 2013, 12:38:13 PM1/3/13
to golang-nuts
I think that with the new improvements on the GC this they are be
reliable on both.

But even if they are equivalent, the 64 bit version is faster and most
server deployments this days use 64 bit processors. No need to stick
with 32 bits unless you have a specific use-case.

--
André Moraes
http://amoraes.info

Daniel Theophanes

unread,
Jan 3, 2013, 1:11:35 PM1/3/13
to golan...@googlegroups.com
I run network servers on both Linux and Windows (on Windows Server 2008 VM) and they both work fine. If you are on 1.0.3, I might suggest compiling from tip as there has been some Windows network improvements. More then anything, you shouldn't panic or die on errors, just log them. Does your entire http server stop accepting incoming connections?

-Daniel

bryanturley

unread,
Jan 3, 2013, 1:32:10 PM1/3/13
to golan...@googlegroups.com


On Thursday, January 3, 2013 11:47:54 AM UTC-6, Constantine Vasil wrote:
64-bit - definitely. I would be interested to know whatLinux distro is Google using?

I believe they use Ubuntu on desktops probably their own mix for servers.
Any major distro that is up to date should work fine for you, it is more a personal taste issue since 95% of the software is the same on all distro's (ignoring version numbers).

Most people find Ubuntu helpful and easy to use, but I feel like it gets in my way so I use Fedora.
If you are new to linux though Ubuntu or CentOS 6 are probably good stops for you.
They have a good bit of public documentation and discussion freely available.

Kyle Lemons

unread,
Jan 3, 2013, 2:07:32 PM1/3/13
to ths...@gmail.com, golang-nuts
On Thu, Jan 3, 2013 at 9:47 AM, <ths...@gmail.com> wrote:
64-bit - definitely. I would be interested to know whatLinux distro is Google using?

(complete with quotes from another Gopher you'll see around the mailing list)
 
--
 
 

Matt Kane's Brain

unread,
Jan 3, 2013, 2:14:36 PM1/3/13
to Kyle Lemons, ths...@gmail.com, golang-nuts
Is Goobuntu on servers too?

--
 
 

André Moraes

unread,
Jan 3, 2013, 2:18:18 PM1/3/13
to golang-nuts
On Thu, Jan 3, 2013 at 5:14 PM, Matt Kane's Brain
<mkb-...@hydrogenproject.com> wrote:
> Is Goobuntu on servers too?

I saw one presentation from Bushnell on some site related to Ubuntu,
and he is very emphatic:

"We don't discuss that in public"

Which is a little said (but understandable). :)

André Moraes

unread,
Jan 3, 2013, 2:18:33 PM1/3/13
to ths...@gmail.com, golan...@googlegroups.com
On Thu, Jan 3, 2013 at 3:46 PM, <ths...@gmail.com> wrote:
> " "The specified network name is no longer available" in any other OS
> besides Windows? I will need to use some Linux or FreeBSD instances with
> Virtual Machine
> under Windows 2008 Server Host. What it is recommended for this use case?

This error happens on the Go program or in the Virtual Machine application?
Message has been deleted

Andy Balholm

unread,
Jan 3, 2013, 2:37:55 PM1/3/13
to golan...@googlegroups.com, ths...@gmail.com
On Thursday, January 3, 2013 9:46:06 AM UTC-8, Constantine Vasil wrote:
I have other considerations choosing underlying OS - using LevelDB. DB is determining factor
and it seems DragonFly BSD is good choice. Based on FreeBSD with improvements like

HAMMER - DragonFly Filesystem, Transparent disk encryption, SWAPCACHE - Managed SSD support

it seems suitable for this requirement. Any thoughts and considerations?

DragonFly BSD is not a supported OS for Go. Since it's fairly similar to FreeBSD, porting Go to it is probably not as hard as it would be to some other OSes, but I would recommend sticking to something that's officially supported.

Archos

unread,
Jan 3, 2013, 2:43:07 PM1/3/13
to golan...@googlegroups.com, ths...@gmail.com
I use FreeBSD in my DB server, but the app. server is hosted in Debian, and although I prefer to use FreeBSD in servers is more difficult to find dedicated servers where to can install BSD systems to a good price.

El jueves, 3 de enero de 2013 17:46:06 UTC, Constantine Vasil escribió:
From number of responses for so short time I see Linux community is 
much more helpful. Does anyone else got this error leading to a crash:
" "The specified network name is no longer available" in any other OS 
besides Windows? I will need to use some Linux or FreeBSD instances with Virtual Machine
under Windows 2008 Server Host. What it is recommended for this use case?

I have other considerations choosing underlying OS - using LevelDB. DB is determining factor
and it seems DragonFly BSD is good choice. Based on FreeBSD with improvements like

HAMMER - DragonFly Filesystem, Transparent disk encryption, SWAPCACHE - Managed SSD support

it seems suitable for this requirement. Any thoughts and considerations?


Nate Finch

unread,
Jan 3, 2013, 3:01:36 PM1/3/13
to golan...@googlegroups.com
I use Ubuntu 12.04 LTS 32 bit because it was the only version that didn't have serious problems on my 9 month old dell laptop.  The newest Ubuntu had a ton of problems with my laptop (mouse jumped around and was unusable), and 64 bit 12.04 did not function in several critical areas (I forget exactly what).  32 bit works like a dream. Since it's just a dev laptop, not production, it's not a huge deal for me for now.

Thomas Bushnell, BSG

unread,
Jan 3, 2013, 5:57:38 PM1/3/13
to Constantine Vasil, golang-nuts
Ubuntu is not "desktop oriented"; it's fine for both desktops and servers. They take both equally seriously.


On Thu, Jan 3, 2013 at 11:15 AM, Constantine Vasil <ths...@gmail.com> wrote:
This was interesting to know:
"In particular, Google uses the latest long term support (LTS) of Ubuntu. That means that if you download a copy of the latest version of Ubuntu, 12.04.1, you will, for most practical purposes, be running Goobuntu."

Ubuntu is for desktop. Now if we can know what OS distribution Google is using for server side, it would light some guidance. 
--
 
 

Dave Cheney

unread,
Jan 3, 2013, 5:58:00 PM1/3/13
to Constantine Vasil, golan...@googlegroups.com
Is your program running as root ? Only root/Adminstrator can listen on
ports < 1024.

On Fri, Jan 4, 2013 at 5:16 AM, Constantine Vasil <ths...@gmail.com> wrote:
> Here is the info I have about this error.
>
> I am using Windows Server 2008 R2 in VMware ESXi.
>
> here is the main code part.
>
> const listenAddr = "0.0.0.0:80"
> ...
> http.HandleFunc("/", logPanics(handler))
>
> err := http.ListenAndServe(listenAddr, nil)
> if err != nil {
> log.Printf("ListenAndServe: %s", err)
> panic(err)
> }
>
> func logPanics(function HandleFnc) HandleFnc {
> return func(writer http.ResponseWriter, request *http.Request) {
> defer func() {
> if x := recover(); x != nil {
> log.Printf("[%v] caught panic: %v", request.RemoteAddr, x)
> }
> }()
> function(writer, request)
> }
> }
>
> but got this message:
> //2012/12/07 08:06:39 ListenAndServe: AcceptEx tcp 0.0.0.0:80: The
> specified network name is no longer available.
> 2012/12/09 22:35:20 ListenAndServe: AcceptEx tcp 0.0.0.0:80: The specified
> netwo
> rk name is no longer available.
> panic: AcceptEx tcp 0.0.0.0:80: The specified network name is no longer
> availabl
> e.
>
> goroutine 1 [running]:
> main.main()
> c:/GoApp/webServer.go:243 +0x84b
>
> goroutine 2 [syscall]:
> created by runtime.main
>
> C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/runti
> me/proc.c:221
>
> goroutine 7 [select]:
> net.(*ioSrv).ProcessRemoteIO(0xf840068970, 0x0)
>
> C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/net/f
> d_windows.go:138 +0x1b5
> created by net.startServer
>
> C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/net/f
> d_windows.go:216 +0x1ab
>
> goroutine 6 [syscall]:
> syscall.Syscall6(0x76fda4d0, 0x5, 0xa0, 0xf8400bf440, 0xf84006f328, ...)
>
> C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/runti
> me/zsyscall_windows_amd64.c:97 +0x55
> syscall.GetQueuedCompletionStatus(0xa0, 0xf8400bf440, 0xf84006f328,
> 0xf84006f320
> , 0xffffffff, ...)
>
> C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/sysca
> ll/zsyscall_windows_amd64.go:500 +0x9e
> net.(*resultSrv).Run(0xf84006f240, 0x0)
>
> C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/net/f
> d_windows.go:107 +0x97
> created by net.startServer
>
> C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/net/f
> d_windows.go:211 +0x12b
> --
>
>

brainman

unread,
Jan 3, 2013, 8:19:38 PM1/3/13
to golan...@googlegroups.com
On Friday, 4 January 2013 05:16:13 UTC+11, Constantine Vasil wrote:

> ListenAndServe: AcceptEx tcp 0.0.0.0:80: The specified network name is no longer available.

I do not receive this error myself, but here are couple of options you could try:

1) As suggested by Daniel, try to use "tip" version of Go - there were a few changes to net package that could fix your problem;

2) Do not run your program in vmware, run it natively - vmware implements network driver, so the error could be specific to that;

3) You could change your ListenAndServe to ignore this error - if these errors are rare in your situation, perhaps, they are safe to be ignored.

If you can reliably reproduce the error, I will be happy to investigate.

Alex

Constantine Vasil

unread,
Jan 3, 2013, 9:48:52 PM1/3/13
to golan...@googlegroups.com
HI Alex,

I suppose the issue is in VMWare network driver as you suggested. 

So I moved to Amazon AWS. What is recommended environment 
suitable for Golang in this case? 

What is "tip" version of Go?

Thanks in advance,
Constantine

Daniel Theophanes

unread,
Jan 3, 2013, 9:57:25 PM1/3/13
to Constantine Vasil, golan...@googlegroups.com
Hi Constantine,

Go works fine on Amazon AWS on both Windows and Linux I run on both.

The "tip" version is compiling the latest from source.
http://golang.org/doc/install

-Daniel

brainman

unread,
Jan 3, 2013, 10:00:57 PM1/3/13
to golan...@googlegroups.com
On Friday, 4 January 2013 13:48:52 UTC+11, Constantine Vasil wrote:

> So I moved to Amazon AWS. What is recommended environment suitable for Golang in this case?

I do not know anything about "recommended environment". But, others complained with the similar problem in a similar environment. As to AWS, as far as I know Go windows builders from http://build.golang.org/ run on AWS (http://code.google.com/p/go-wiki/wiki/DashboardBuilders). These run batch of tests for every version committed. We do not see any errors like yours there.


> What is "tip" version of Go?

You must install from source files. And use "latest" version from Mercurial. See http://golang.org/doc/install/source for instructions (you will need to make adjustments for windows), also, when fetching source use "hg clone https://code.google.com/p/go" command instead of "hg clone -u release https://code.google.com/p/go". This should give you the "tip".

Alex

Constantine Vasil

unread,
Jan 3, 2013, 10:08:05 PM1/3/13
to golan...@googlegroups.com
>recommended environment

I plan to use some of Linux distributions and because there are so many 
wondered which one to chose. 

Constantine Vasil

unread,
Jan 3, 2013, 10:10:21 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
>The "tip" version is compiling the latest from source. 
I see what a "tip" means. Yes I am compiling from source. But decided to not use Windows anymore.

What Linux distribution do you recommend for using Go in Amazon AWS?

Patrick Mylund Nielsen

unread,
Jan 3, 2013, 10:12:07 PM1/3/13
to Constantine Vasil, golang-nuts
Any x64 Linux and you should be good. I don't know of any Linux distro that is a *bad* fit with Go.

FWIW, the Ubuntu Server and Amazon Linux (RHEL-based) images are both pretty small, and easy to set up, so if you just want to run Go, those (x64 versions) are probably good choices.


--
 
 

Dave Cheney

unread,
Jan 3, 2013, 10:13:02 PM1/3/13
to Constantine Vasil, golan...@googlegroups.com
For Linux, the only requirement is kernel version 2.6.32 or later. This rules out rhel/centos 5
--
 
 

Dave Cheney

unread,
Jan 3, 2013, 10:14:41 PM1/3/13
to Constantine Vasil, golan...@googlegroups.com, Constantine Vasil
Gratuitous plug for my employer, Ubuntu 12.04 LTS works well in many Cloud environments. 

Here endth the self promotion.  
--
 
 

Constantine Vasil

unread,
Jan 3, 2013, 10:26:52 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
>Amazon Linux (RHEL-based) 
http://aws.amazon.com/amazon-linux-ami/
As I see it is EC2-optimized Linux. If it is good for Golang probably it is better to use this version.
The information that it is pretty small is what I need.

About Ubuntu Server - what is the difference form Ubuntu cloud?

Patrick Mylund Nielsen

unread,
Jan 3, 2013, 10:30:05 PM1/3/13
to Constantine Vasil, golang-nuts
Same thing.

Yes, I agree Amazon Linux is very small and optimized. Only caveat is that it's RPM-based/you have to use yum. If you don't have a problem with that, then go for it (no pun intended.) :)


--
 
 

Constantine Vasil

unread,
Jan 3, 2013, 10:32:00 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
You mean it rules out Amazon Linux (RHEL-based)?

Constantine Vasil

unread,
Jan 3, 2013, 10:36:41 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
>use "hg clone https://code.google.com/p/go" command 
Thank you, this was useful info. I am compiling a "documentation" of these tips. ;) 

Patrick Mylund Nielsen

unread,
Jan 3, 2013, 10:37:16 PM1/3/13
to Constantine Vasil, golang-nuts
No, Amazon Linux uses 3.x: http://aws.amazon.com/amazon-linux-ami/2012.09-release-notes/. It's just for old RHEL (and CentOS uses quite old packages, although I believe CentOS 6.x is also compatible.)


--
 
 

Dave Cheney

unread,
Jan 3, 2013, 10:46:01 PM1/3/13
to Constantine Vasil, golan...@googlegroups.com
RHEL 5 and CentOS 5 are based on kernel 2.6.18.
> --
>
>

Constantine Vasil

unread,
Jan 3, 2013, 10:46:11 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
>Only caveat is that it's RPM-based/you have to use yum
is that an issue?

Dave Cheney

unread,
Jan 3, 2013, 10:46:40 PM1/3/13
to Constantine Vasil, golan...@googlegroups.com
>>Only caveat is that it's RPM-based/you have to use yum
> is that an issue?

Not if you are agnostic.

Constantine Vasil

unread,
Jan 3, 2013, 10:50:26 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
Bottom line: does Amazon Linux work with Golang or not? ;)

Patrick Mylund Nielsen

unread,
Jan 3, 2013, 10:51:59 PM1/3/13
to Constantine Vasil, golang-nuts
Yes. There is no issue.


--
 
 

Constantine Vasil

unread,
Jan 3, 2013, 10:57:23 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
Are there additional charge for using it?

Constantine Vasil

unread,
Jan 3, 2013, 11:04:16 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
The last question remained will it work on Micro instance for starters.

Dave Cheney

unread,
Jan 3, 2013, 11:05:07 PM1/3/13
to Constantine Vasil, golan...@googlegroups.com
Yes
> --
>
>

Constantine Vasil

unread,
Jan 3, 2013, 11:08:01 PM1/3/13
to golan...@googlegroups.com, Constantine Vasil
I think this forum is most useful and people here so helpful. Thank you 
for all suggestions, tips and patience. ;)
Reply all
Reply to author
Forward
0 new messages