What's the difference between scgi and wsgi?

2019-02-03 12:13发布

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

标签: python wsgi scgi
3条回答
走好不送
2楼-- · 2019-02-03 12:49

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.

查看更多
叛逆
3楼-- · 2019-02-03 13:01

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.

查看更多
Deceive 欺骗
4楼-- · 2019-02-03 13:06

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.

查看更多
登录 后发表回答