Go web服务器在长期稳定性方面与Tomcat、Apache相比如何?

huangapple go评论94阅读模式
英文:

Go webserver how is the performance stability, in terms of long run stability compared to Tomcat, Apache?

问题

我一直在考虑是否使用以下工具来代替:

  • Tomcat
  • Apache
  • 轻量级Web服务器
  • PHP
  • Ruby
  • JSP

为什么不将我的项目转换为Go语言呢?因为在Go语言中:

  • 内置了Web服务器
  • 我甚至不需要依赖于PHP、Ruby、JSP
  • Go解决了跨平台问题,可以在FreeBSD、Linux、Solaris(Windows、Mac、Android、Tizen)上运行
  • 无需维护Apache、Tomcat或其他Web服务器
  • 浏览器的速度比其他Web服务器脚本语言要快得多。

但我担心的是,与其他Web服务器相比,Go Web服务器的稳定性如何。

有人以前做过这个吗?还是只有我一个人在为生产发布构建这样的项目?

英文:

I have been thinking instead of using:

  • Tomcat
  • Apache
  • Lightweight webserver
  • PHP
  • Ruby
  • JSP

Why not switch my projects to Go language. Because there i have:

  • webserver built in
  • i do not even need to depend on PHP, Ruby, JSP
  • Go solves cross-platform such as: runs on FreeBSD, Linux, Solaris (Windows, Mac, Android, Tizen)
  • nor Apache nor Tomcat nor other webserver maintainence
  • speed of browser would be extreamly faster then other web server scripting languages.

But one thing i am worried about, which is the stablity of Go webserver compared to other webservers.

Has anyone done this before or am i alone building such projects for production releases?

答案1

得分: 19

没有稳定性问题。

我有一些完全使用Go编写的Web服务器,运行了几个月,每月处理大约一百万个查询,没有任何问题(主要是通过GET、POST和Websockets传输JSON数据)。

它们运行在64位的Ubuntu服务器上,但我猜你很难产生那么多人谈论的32位bug,尤其是在一个Web服务器上。

如果没有特殊原因,不要使用前端:只使用Go就可以轻松构建完整的Web应用程序。

你不会感到孤单。我认为Go特别适合构建长时间运行的服务器。Goroutines和channels使得处理用户请求和长期任务变得非常容易(或者,例如,在回答HTTP请求后对用户查询进行后处理,这在PHP中并不容易,在Java中如果要正确地完成这个任务则需要太多的代码行数)。

英文:

There are no stability problem.

I have a few webservers 100% in go that run for months, serving about a million queries per month without any problem (mostly json, through GET, POST, and websockets).

They're on 64 bits ubuntu servers but I guess you would have difficulties producing the so much gossiped about 32 bits bug, especially with a web server.

Don't use a front-end if you have no specific reason : It's easy to make a complete web application just using Go.

You will be far from alone. In my opinion Go is especially well suited to build long running servers. Goroutines and channels makes it really easy to handle both user requests and long term tasks (or, for example, do the postreatment of user queries after you answered the http query, which isn't so easy in php and is too many LOC in java if you want to do it properly).

答案2

得分: 1

为什么不使用内置的Web服务器并设置一个反向代理,比如Varnish,或者让Nginx充当代理?

http://wiki.nginx.org/ReverseProxyCachingExample

英文:

Why not using the Build in Webserver and set up a Reverse Proxy like Varnish, or let Nginx act as Proxy?

http://wiki.nginx.org/ReverseProxyCachingExample

答案3

得分: 0

使用Nginx作为前端,并确保您使用的是64位版本的Go。32位版本存在严重的稳定性问题,这对于任何长时间运行的进程都是一个阻碍。

英文:

Use Nginx as the front-end and make sure that you are using the 64bit version of Go. The 32bit version has severe stability problems which are a show stopper for any long-running processes.

huangapple
  • 本文由 发表于 2012年4月13日 14:54:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/10136478.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定