File: introduction.rst

package info (click to toggle)
libapache2-mod-python 3.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,128 kB
  • sloc: python: 7,450; ansic: 7,016; makefile: 291; lex: 246; sh: 175; javascript: 1
file content (65 lines) | stat: -rw-r--r-- 2,395 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.. _introduction:

************
Introduction
************

.. _performance:

Performance
===========

One of the main advantages of mod_python is the increase in
performance over traditional CGI. Below are results of a very crude
test. The test was done on a 1.2GHz Pentium machine running Red Hat
Linux 7.3. `Ab <http://httpd.apache.org/docs-2.0/programs/ab.html>`_
was used to poll 4 kinds of scripts, all of which imported the
standard cgi module (because this is how a typical Python cgi script
begins), then output a single word ``'Hello!'``. The results are
based on 10000 requests with concurrency of 1::

   Standard CGI:               23 requests/s
   Mod_python cgihandler:     385 requests/s
   Mod_python publisher:      476 requests/s
   Mod_python handler:       1203 requests/s


.. _apache_api:

Apache HTTP Server API
======================

Apache processes requests in *phases* (i.e. read the request, parse
headers, check access, etc.). Phases are implemented by
functions called *handlers*. Traditionally, handlers are written in C
and compiled into Apache modules. Mod_python provides a way to extend
Apache functionality by writing Apache handlers in Python. For a
detailed description of the Apache request processing process, see the
`Apache Developer Documentation <http://httpd.apache.org/docs/2.4/developer/>`_, as well as the
`Mod_python - Integrating Python with Apache <http://www.modpython.org/python10/>`_
paper.

Currently only a subset of the Apache HTTP Server API is accessible
via mod_python. It was never the goal of the project to provide a 100%
coverage of the API. Rather, mod_python is focused on the most useful
parts of the API and on providing the most "Pythonic" ways of using
it.

.. _intro_other:

Other Features
==============

Mod_python also provides a number features that fall in the category
of web development, e.g. a parser for embedding Python in HTML
(:ref:`pyapi-psp`), a handler that maps URL space into modules and
functions (:ref:`hand-pub`), support for session (:ref:`pyapi-sess`)
and cookie (:ref:`pyapi-cookie`) handling.

.. seealso::

   `Apache HTTP Server Developer Documentation <http://httpd.apache.org/docs/2.4/developer/>`_
      for HTTP developer information

   `Mod_python - Integrating Python with Apache <http://www.modpython.org/python10/>`_
      for details on how mod_python interfaces with Apache HTTP Server