scgi 和 wsgi 有什么区别?

发布于 2024-07-08 10:42:57 字数 29 浏览 9 评论 0 原文

这两者有什么区别? 哪个更好/更快/可靠?

What's the difference between these two?
Which is better/faster/reliable?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ㄟ。诗瑗 2024-07-15 10:42:58

它们都是将 Web 应用程序插入 Web 服务器的规范。 一个明显的区别是 WSGI 来自 Python 世界,我相信不存在非 Python 实现。

规范通常不具有基于更好/更快/可靠的可比性。

只有它们的实现具有可比性,我相信您会找到这两种规范的良好实现。

也许阅读阅读

They are both specifications for plugging a web application into a web server. One glaring difference is that WSGI comes from the Python world, and I believe there are no non-python implementations.

Specifications are generally not comparable based on better/faster/reliable.

Only their implementations are comparable, and I am sure you will find good implementations of both specifications.

Perhaps read and read.

森末i 2024-07-15 10:42:57

SCGI 是一种与语言无关的连接前端 Web 服务器和 Web 应用程序的方法。 WSGI 是针对 Web 应用程序的 Python 特定接口标准。

尽管它们都源于 CGI,但它们的范围相当不同,您确实可以相当合理地同时使用两者,例如,让 Web 服务器上的 mod_scgi 与作为 SCGI 服务器运行的 WSGI 应用程序进行通信。 有多个库实现可以将 WSGI 应用程序作为 SCGI 服务器运行(例如 wsgitools、cherrypy)。

它们都是“可靠的”,因为您可以认为规范相对于特定的实现是可靠的。 如今,您可能会将应用程序编写为可调用的 WSGI,并单独考虑部署问题。

也许 Apache+mod_wsgi(嵌入式)接口可能比 Apache+mod_scgi+(SCGI 包装库)快一点,但很可能它不会有很大不同。 更有价值的是能够在各种服务器、平台和连接标准上运行应用程序。

SCGI is a language-neutral means of connecting a front-end web server and a web application. WSGI is a Python-specific interface standard for web applications.

Though they both have roots in CGI, they're rather different in scope and you could indeed quite reasonably use both at once, for example having a mod_scgi on the webserver talk to a WSGI app run as an SCGI server. There are multiple library implementations that will run WSGI applications as SCGI servers for you (eg. wsgitools, cherrypy).

They are both 'reliable', in as much as you can consider a specification reliable as opposed to a particular implementation. These days you would probably write your application as a WSGI callable, and consider the question of deployment separately.

Maybe an Apache+mod_wsgi (embedded) interface might be a bit faster than an Apache+mod_scgi+(SCGI wrapper lib), but in all likelihood it's not going to be hugely different. More valuable is the ability to run the application on a variety of servers, platforms and connection standards.

梅倚清风 2024-07-15 10:42:57

SCGI(如 FastCGI)是一种(序列化)协议,适用于 Web 服务器和 Web 应用程序之间的进程间通信。

WSGI 是一个 Python API,连接同一进程(Python 解释器)内的两个(或多个)Python WSGI 兼容模块。 一个模块代表 Web 服务器(可以是 Python 进程内 Web 服务器实现,也可以是通过 SCGI 等连接到另一进程中的 Web 服务器的网关)。 另一个模块是或代表网络应用程序。 此外,这两个模块之间的零个或多个模块可以充当 WSGI“中间件”模块,执行会话/cookie 管理、内容缓存、身份验证等操作。WSGI API 使用 Python 语言功能,例如迭代/生成器和传递可调用函数协作的 WSGI 兼容模块之间的对象。

SCGI (like FastCGI) is a (serialized) protocol suitable for inter-process communication between a web-server and a web-application.

WSGI is a Python API, connecting two (or more) Python WSGI-compatible modules inside the same process (Python interpreter). One module represents the web-server (being either a Python in-process web-server implementation or a gateway to a web-server in another process via e.g. SCGI). The other module is or represents the web application. Additionally, zero or more modules between theses two modules, may serve as WSGI "middleware" modules, doing things like session/cookie management, content caching, authentication, etc. The WSGI API uses Python language features like iteration/generators and passing of callable objects between the cooperating WSGI-compatible modules.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文