English 中文(简体)
Is there a speed difference between WSGI and FCGI?
原标题:

From the web I ve gleaned that WSGI is a CGI for python web development/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don t know the performance difference between the two in reference to the languages python and C/++.

最佳回答

Correct, WSGI is a Python programmatic API definition and FASTCGI is a language agnostic socket wire protocol definition. Effectively they are at different layers with WSGI being a higher layer. In other words, one can implement WSGI on top of something that so happened to use FASTCGI to communicate with a web server, but not the other way around.

In general, FASTCGI being a socket wire protocol means that you always need some type of programmatic interface on top to use it. For Python one such option is WSGI. As FASTCGI is just a means to an end, one can t really compare its performance to WSGI in that case because WSGI isn t a comparable socket wire protocol, but a user of FASTCGI itself.

One could try and compare performance of different language interfaces on top of FASTCGI, but in general that is quite meaningless in itself as the lower network layer and server request handling aren t the bottleneck. Instead your application code and database will be.

问题回答

They are two different things. WSGI is a Python specific interface for writing web applications. There are wrappers for about any web server protocol to provide the WSGI interface. FastCGI (FCGI) is one of such web server protocols. So, WSGI is an abstraction layer, while CGI / FastCGI / mod_python are how the actual web servers talk to the application. Some code has to translate the native interface to WSGI (there is a CGI module in wsgiref, there is flup for FastCGI, etc.). There is also mod_wsgi for Apache, which does the translation directly in an Apache module, so you don t need any Python wrapper.





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签