dowbwrr3590709 2013-12-25 10:44
浏览 287
已采纳

为什么不使用golang WSGI实现

We have concurrent issues in Python. These WSGI Servers just do not work that wonderful. I have a look around, get nothing like a Golang written WSGI Server with its goroutines.

Any reasons?

  • 写回答

3条回答 默认 最新

  • douqi1931 2013-12-25 11:21
    关注

    WSGI protocol is specific to Python. With Go you have three options (actually, four, but plain CGI should supposedly be not considered for moderate to high load setups):

    • Built-in HTTP serving facilities of Go's standard library.

      In this case your app is a standalone server. This might be the simplest setup but it might have the following problems:

      • To run your app with downgraded privileges (you have to do this) on a privileged port number (below 1024, and 80 is in this range) you'll need to use a specialized wrapper or POSIX capabilities.
      • To provide for graceful redeployments without losing connections, you'll need another wrapper (like goagain).
    • Same as above, but behind a reverse HTTP proxy in the form of a web server.

      Mostly removes the problems of the standalone variant but still have the overhead of passing full HTTP traffic back and forth.

    • FastCGI via a suitable webserver. Nginx and Apache (and numerous others) are okay with this. FCGI client implementation is available in the Go standard library.

      In addition to not having the problems of the standalone setup, implements a more efficient data exchange protocol. Another bonus is that your Go server might communicate with the front-end web server using Unix pipes which have less transmission cost than TCP sockets involved in the reverse HTTP proxy variant.

    So, if your setup currently uses WSGI, I'd say go with FCGI.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 matlab实现基于主成分变换的图像融合。
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊